diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2021-07-01 23:30:34 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2021-07-01 23:30:34 +0200 |
commit | 66a1cf3e873e9473fe6dc4df987cd61fcaebc37a (patch) | |
tree | f4b6866fc1f5b507cf4bbcb2177c7f43d09a9ccf | |
parent | new [commands]: added fix_article_entry_id command. (diff) | |
download | newspipe-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.py | 8 |
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) |