87 lines
2.9 KiB
Python
87 lines
2.9 KiB
Python
"""refcomp index
|
|
|
|
Revision ID: 92789d50f6b6
|
|
Revises: 00ad500fb118
|
|
Create Date: 2021-12-03 10:56:43.921559
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "92789d50f6b6"
|
|
down_revision = "00ad500fb118"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table("modules_acs")
|
|
op.drop_table("app_crit")
|
|
op.add_column("apc_annee_parcours", sa.Column("ordre", sa.Integer(), nullable=True))
|
|
op.drop_column("apc_annee_parcours", "numero")
|
|
op.create_index(
|
|
op.f("ix_apc_app_critique_code"), "apc_app_critique", ["code"], unique=False
|
|
)
|
|
op.create_unique_constraint(
|
|
"apc_competence_referentiel_id_titre_key",
|
|
"apc_competence",
|
|
["referentiel_id", "titre"],
|
|
)
|
|
op.create_index(
|
|
op.f("ix_apc_competence_titre"), "apc_competence", ["titre"], unique=False
|
|
)
|
|
op.add_column(
|
|
"apc_referentiel_competences",
|
|
sa.Column("scodoc_date_loaded", sa.DateTime(), nullable=True),
|
|
)
|
|
op.add_column(
|
|
"apc_referentiel_competences",
|
|
sa.Column("scodoc_orig_filename", sa.Text(), nullable=True),
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_column("apc_referentiel_competences", "scodoc_orig_filename")
|
|
op.drop_column("apc_referentiel_competences", "scodoc_date_loaded")
|
|
op.drop_index(op.f("ix_apc_competence_titre"), table_name="apc_competence")
|
|
op.drop_constraint(
|
|
"apc_competence_referentiel_id_titre_key", "apc_competence", type_="unique"
|
|
)
|
|
op.drop_index(op.f("ix_apc_app_critique_code"), table_name="apc_app_critique")
|
|
op.add_column(
|
|
"apc_annee_parcours",
|
|
sa.Column("numero", sa.INTEGER(), autoincrement=False, nullable=True),
|
|
)
|
|
op.drop_column("apc_annee_parcours", "ordre")
|
|
op.create_table(
|
|
"app_crit",
|
|
sa.Column(
|
|
"id",
|
|
sa.INTEGER(),
|
|
server_default=sa.text("nextval('app_crit_id_seq'::regclass)"),
|
|
autoincrement=True,
|
|
nullable=False,
|
|
),
|
|
sa.Column("code", sa.TEXT(), autoincrement=False, nullable=False),
|
|
sa.Column("titre", sa.TEXT(), autoincrement=False, nullable=True),
|
|
sa.PrimaryKeyConstraint("id", name="app_crit_pkey"),
|
|
postgresql_ignore_search_path=False,
|
|
)
|
|
op.create_table(
|
|
"modules_acs",
|
|
sa.Column("module_id", sa.INTEGER(), autoincrement=False, nullable=True),
|
|
sa.Column("ac_id", sa.INTEGER(), autoincrement=False, nullable=True),
|
|
sa.ForeignKeyConstraint(
|
|
["ac_id"], ["app_crit.id"], name="modules_acs_ac_id_fkey"
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["module_id"], ["notes_modules.id"], name="modules_acs_module_id_fkey"
|
|
),
|
|
)
|
|
# ### end Alembic commands ###
|