aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2021-07-07 08:18:09 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2021-07-07 08:18:09 +0200
commitbba26593a3351d9a1cd20b2e182110e9d08329b0 (patch)
treefdda4b75744bfd7a6315fdde283ea250c52f5e45
parentvarious fixes concerning the management of the tags (diff)
downloadnewspipe-bba26593a3351d9a1cd20b2e182110e9d08329b0.tar.gz
newspipe-bba26593a3351d9a1cd20b2e182110e9d08329b0.tar.bz2
newspipe-bba26593a3351d9a1cd20b2e182110e9d08329b0.zip
updated foreign_keys for bookmarfs in tag.py
-rw-r--r--newspipe/models/bookmark.py3
-rw-r--r--newspipe/models/feed.py4
-rw-r--r--newspipe/models/tag.py6
3 files changed, 6 insertions, 7 deletions
diff --git a/newspipe/models/bookmark.py b/newspipe/models/bookmark.py
index a008ff07..05c5da58 100644
--- a/newspipe/models/bookmark.py
+++ b/newspipe/models/bookmark.py
@@ -62,8 +62,7 @@ class Bookmark(db.Model, RightMixin):
tags = db.relationship(
"BookmarkTag",
back_populates="bookmark",
- cascade="all,delete-orphan",
- lazy=False,
+ cascade="all, delete-orphan",
foreign_keys="[BookmarkTag.bookmark_id]",
)
tags_proxy = association_proxy("tags", "text")
diff --git a/newspipe/models/feed.py b/newspipe/models/feed.py
index 7e8d92ae..1d3893fb 100644
--- a/newspipe/models/feed.py
+++ b/newspipe/models/feed.py
@@ -60,10 +60,12 @@ class Feed(db.Model, RightMixin):
last_error = db.Column(db.String(), default="")
error_count = db.Column(db.Integer(), default=0)
- # relationship
+ # foreign keys
icon_url = db.Column(db.String(), db.ForeignKey("icon.url"), default=None)
user_id = db.Column(db.Integer(), db.ForeignKey("user.id"))
category_id = db.Column(db.Integer(), db.ForeignKey("category.id"))
+
+ # relationship
articles = db.relationship(
Article,
backref="source",
diff --git a/newspipe/models/tag.py b/newspipe/models/tag.py
index 02a6d29f..0c961830 100644
--- a/newspipe/models/tag.py
+++ b/newspipe/models/tag.py
@@ -33,10 +33,8 @@ class BookmarkTag(db.Model):
text = db.Column(db.String, unique=False)
# foreign keys
- user_id = db.Column(db.Integer, db.ForeignKey("user.id", ondelete="CASCADE"))
- bookmark_id = db.Column(
- db.Integer, db.ForeignKey("bookmark.id", ondelete="CASCADE")
- )
+ user_id = db.Column(db.Integer, db.ForeignKey("user.id"))
+ bookmark_id = db.Column(db.Integer, db.ForeignKey("bookmark.id"))
# relationships
bookmark = db.relationship(
bgstack15