forked from ScoDoc/DocScoDoc
129 lines
3.9 KiB
Python
129 lines
3.9 KiB
Python
|
"""Validations BUT
|
||
|
|
||
|
Revision ID: 4311cc342dbd
|
||
|
Revises: a2771105c21c
|
||
|
Create Date: 2022-05-28 16:46:09.861248
|
||
|
|
||
|
"""
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = "4311cc342dbd"
|
||
|
down_revision = "a2771105c21c"
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table(
|
||
|
"apc_validation_annee",
|
||
|
sa.Column("id", sa.Integer(), nullable=False),
|
||
|
sa.Column("etudid", sa.Integer(), nullable=False),
|
||
|
sa.Column("ordre", sa.Integer(), nullable=False),
|
||
|
sa.Column("formsemestre_id", sa.Integer(), nullable=True),
|
||
|
sa.Column("annee_scolaire", sa.Integer(), nullable=False),
|
||
|
sa.Column(
|
||
|
"date",
|
||
|
sa.DateTime(timezone=True),
|
||
|
server_default=sa.text("now()"),
|
||
|
nullable=True,
|
||
|
),
|
||
|
sa.Column("code", sa.String(length=16), nullable=False),
|
||
|
sa.ForeignKeyConstraint(["etudid"], ["identite.id"], ondelete="CASCADE"),
|
||
|
sa.ForeignKeyConstraint(
|
||
|
["formsemestre_id"],
|
||
|
["notes_formsemestre.id"],
|
||
|
),
|
||
|
sa.PrimaryKeyConstraint("id"),
|
||
|
sa.UniqueConstraint("etudid", "annee_scolaire"),
|
||
|
)
|
||
|
op.create_index(
|
||
|
op.f("ix_apc_validation_annee_code"),
|
||
|
"apc_validation_annee",
|
||
|
["code"],
|
||
|
unique=False,
|
||
|
)
|
||
|
op.create_index(
|
||
|
op.f("ix_apc_validation_annee_etudid"),
|
||
|
"apc_validation_annee",
|
||
|
["etudid"],
|
||
|
unique=False,
|
||
|
)
|
||
|
op.create_table(
|
||
|
"apc_validation_rcue",
|
||
|
sa.Column("id", sa.Integer(), nullable=False),
|
||
|
sa.Column("etudid", sa.Integer(), nullable=False),
|
||
|
sa.Column("formsemestre_id", sa.Integer(), nullable=True),
|
||
|
sa.Column("ue1_id", sa.Integer(), nullable=False),
|
||
|
sa.Column("ue2_id", sa.Integer(), nullable=False),
|
||
|
sa.Column("parcours_id", sa.Integer(), nullable=True),
|
||
|
sa.Column(
|
||
|
"date",
|
||
|
sa.DateTime(timezone=True),
|
||
|
server_default=sa.text("now()"),
|
||
|
nullable=True,
|
||
|
),
|
||
|
sa.Column("code", sa.String(length=16), nullable=False),
|
||
|
sa.ForeignKeyConstraint(["etudid"], ["identite.id"], ondelete="CASCADE"),
|
||
|
sa.ForeignKeyConstraint(
|
||
|
["formsemestre_id"],
|
||
|
["notes_formsemestre.id"],
|
||
|
),
|
||
|
sa.ForeignKeyConstraint(
|
||
|
["parcours_id"],
|
||
|
["apc_parcours.id"],
|
||
|
),
|
||
|
sa.ForeignKeyConstraint(
|
||
|
["ue1_id"],
|
||
|
["notes_ue.id"],
|
||
|
),
|
||
|
sa.ForeignKeyConstraint(
|
||
|
["ue2_id"],
|
||
|
["notes_ue.id"],
|
||
|
),
|
||
|
sa.PrimaryKeyConstraint("id"),
|
||
|
sa.UniqueConstraint("etudid", "formsemestre_id", "ue1_id", "ue2_id"),
|
||
|
)
|
||
|
op.create_index(
|
||
|
op.f("ix_apc_validation_rcue_code"),
|
||
|
"apc_validation_rcue",
|
||
|
["code"],
|
||
|
unique=False,
|
||
|
)
|
||
|
op.create_index(
|
||
|
op.f("ix_apc_validation_rcue_etudid"),
|
||
|
"apc_validation_rcue",
|
||
|
["etudid"],
|
||
|
unique=False,
|
||
|
)
|
||
|
op.create_index(
|
||
|
op.f("ix_apc_validation_rcue_formsemestre_id"),
|
||
|
"apc_validation_rcue",
|
||
|
["formsemestre_id"],
|
||
|
unique=False,
|
||
|
)
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.drop_index(
|
||
|
op.f("ix_apc_validation_rcue_formsemestre_id"), table_name="apc_validation_rcue"
|
||
|
)
|
||
|
op.drop_index(
|
||
|
op.f("ix_apc_validation_rcue_etudid"), table_name="apc_validation_rcue"
|
||
|
)
|
||
|
op.drop_index(op.f("ix_apc_validation_rcue_code"), table_name="apc_validation_rcue")
|
||
|
op.drop_table("apc_validation_rcue")
|
||
|
op.drop_index(
|
||
|
op.f("ix_apc_validation_annee_etudid"), table_name="apc_validation_annee"
|
||
|
)
|
||
|
op.drop_index(
|
||
|
op.f("ix_apc_validation_annee_code"), table_name="apc_validation_annee"
|
||
|
)
|
||
|
op.drop_table("apc_validation_annee")
|
||
|
# ### end Alembic commands ###
|