aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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