forked from ScoDoc/DocScoDoc
Fix: cascades sur itemsuivi
This commit is contained in:
parent
21fa7112c8
commit
8fc16dfeda
@ -149,10 +149,13 @@ class ItemSuiviTag(db.Model):
|
||||
# Association tag <-> module
|
||||
itemsuivi_tags_assoc = db.Table(
|
||||
"itemsuivi_tags_assoc",
|
||||
db.Column("tag_id", db.Integer, db.ForeignKey("itemsuivi_tags.id")),
|
||||
db.Column("itemsuivi_id", db.Integer, db.ForeignKey("itemsuivi.id")),
|
||||
db.Column(
|
||||
"tag_id", db.Integer, db.ForeignKey("itemsuivi_tags.id", ondelete="CASCADE")
|
||||
),
|
||||
db.Column(
|
||||
"itemsuivi_id", db.Integer, db.ForeignKey("itemsuivi.id", ondelete="CASCADE")
|
||||
),
|
||||
)
|
||||
# ON DELETE CASCADE ?
|
||||
|
||||
|
||||
class EtudAnnotation(db.Model):
|
||||
|
34
migrations/versions/39818df276aa_cascades_sur_itemsuivi.py
Normal file
34
migrations/versions/39818df276aa_cascades_sur_itemsuivi.py
Normal file
@ -0,0 +1,34 @@
|
||||
"""cascades sur itemsuivi
|
||||
|
||||
Revision ID: 39818df276aa
|
||||
Revises: 1efe07413835
|
||||
Create Date: 2021-11-27 19:03:09.329065
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '39818df276aa'
|
||||
down_revision = '1efe07413835'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('itemsuivi_tags_assoc_tag_id_fkey', 'itemsuivi_tags_assoc', type_='foreignkey')
|
||||
op.drop_constraint('itemsuivi_tags_assoc_itemsuivi_id_fkey', 'itemsuivi_tags_assoc', type_='foreignkey')
|
||||
op.create_foreign_key(None, 'itemsuivi_tags_assoc', 'itemsuivi', ['itemsuivi_id'], ['id'], ondelete='CASCADE')
|
||||
op.create_foreign_key(None, 'itemsuivi_tags_assoc', 'itemsuivi_tags', ['tag_id'], ['id'], ondelete='CASCADE')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'itemsuivi_tags_assoc', type_='foreignkey')
|
||||
op.drop_constraint(None, 'itemsuivi_tags_assoc', type_='foreignkey')
|
||||
op.create_foreign_key('itemsuivi_tags_assoc_itemsuivi_id_fkey', 'itemsuivi_tags_assoc', 'itemsuivi', ['itemsuivi_id'], ['id'])
|
||||
op.create_foreign_key('itemsuivi_tags_assoc_tag_id_fkey', 'itemsuivi_tags_assoc', 'itemsuivi_tags', ['tag_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user