From 66a1cf3e873e9473fe6dc4df987cd61fcaebc37a Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 1 Jul 2021 23:30:34 +0200 Subject: added new ix_articletag_aid index in article_tag --- newspipe/models/tag.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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) -- cgit