modif contrainte sur formations

This commit is contained in:
Emmanuel Viennet 2021-09-19 21:31:35 +02:00
parent 7a0a04bdb3
commit 0381576750
2 changed files with 31 additions and 1 deletions

View File

@ -11,7 +11,7 @@ class NotesFormation(db.Model):
"""Programme pédagogique d'une formation""" """Programme pédagogique d'une formation"""
__tablename__ = "notes_formations" __tablename__ = "notes_formations"
__table_args__ = (db.UniqueConstraint("acronyme", "titre", "version"),) __table_args__ = (db.UniqueConstraint("dept_id", "acronyme", "titre", "version"),)
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
formation_id = db.synonym("id") formation_id = db.synonym("id")

View File

@ -0,0 +1,30 @@
"""modif contrainte sur formations
Revision ID: f86c013c9fbd
Revises: 669065fb2d20
Create Date: 2021-09-19 21:30:42.240422
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f86c013c9fbd'
down_revision = '669065fb2d20'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('notes_formations_acronyme_titre_version_key', 'notes_formations', type_='unique')
op.create_unique_constraint(None, 'notes_formations', ['dept_id', 'acronyme', 'titre', 'version'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'notes_formations', type_='unique')
op.create_unique_constraint('notes_formations_acronyme_titre_version_key', 'notes_formations', ['acronyme', 'titre', 'version'])
# ### end Alembic commands ###