aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2021-07-01 23:30:34 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2021-07-01 23:30:34 +0200
commit66a1cf3e873e9473fe6dc4df987cd61fcaebc37a (patch)
treef4b6866fc1f5b507cf4bbcb2177c7f43d09a9ccf
parentnew [commands]: added fix_article_entry_id command. (diff)
downloadnewspipe-66a1cf3e873e9473fe6dc4df987cd61fcaebc37a.tar.gz
newspipe-66a1cf3e873e9473fe6dc4df987cd61fcaebc37a.tar.bz2
newspipe-66a1cf3e873e9473fe6dc4df987cd61fcaebc37a.zip
added new ix_articletag_aid index in article_tag
-rw-r--r--newspipe/models/tag.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/newspipe/models/tag.py b/newspipe/models/tag.py
index b853c344..0a0fe58c 100644
--- a/newspipe/models/tag.py
+++ b/newspipe/models/tag.py
@@ -1,6 +1,8 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
+from sqlalchemy import Index, ForeignKeyConstraint
+
from newspipe.bootstrap import db
@@ -20,6 +22,12 @@ class ArticleTag(db.Model):
def __init__(self, text):
self.text = text
+ __table_args__ = (
+ ForeignKeyConstraint([article_id], ['article.id'],
+ ondelete='CASCADE'),
+ Index('ix_articletag_aid', article_id),
+ )
+
class BookmarkTag(db.Model):
id = db.Column(db.Integer, primary_key=True)
bgstack15