1
0
forked from ScoDoc/ScoDoc

Fix: suppression semestres avec notifications absences

This commit is contained in:
Emmanuel Viennet 2021-11-09 11:52:41 +01:00
parent ade1b4445c
commit a4e4c39797
2 changed files with 31 additions and 1 deletions

View File

@ -49,7 +49,7 @@ class AbsenceNotification(db.Model):
nbabsjust = db.Column(db.Integer) nbabsjust = db.Column(db.Integer)
formsemestre_id = db.Column( formsemestre_id = db.Column(
db.Integer, db.Integer,
db.ForeignKey("notes_formsemestre.id"), db.ForeignKey("notes_formsemestre.id", ondelete="CASCADE"),
) )

View File

@ -0,0 +1,30 @@
"""added cascade on absences_notifications
Revision ID: 1efe07413835
Revises: 75cf18659984
Create Date: 2021-11-09 11:49:31.739803
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1efe07413835'
down_revision = '75cf18659984'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('absences_notifications_formsemestre_id_fkey', 'absences_notifications', type_='foreignkey')
op.create_foreign_key(None, 'absences_notifications', 'notes_formsemestre', ['formsemestre_id'], ['id'], ondelete='CASCADE')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'absences_notifications', type_='foreignkey')
op.create_foreign_key('absences_notifications_formsemestre_id_fkey', 'absences_notifications', 'notes_formsemestre', ['formsemestre_id'], ['id'])
# ### end Alembic commands ###