"""BUT: poids evaluations, AC

Revision ID: ada0d1f3d84f
Revises: 1efe07413835
Create Date: 2021-11-07 22:49:22.697211

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "ada0d1f3d84f"
down_revision = "39818df276aa"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "app_crit",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("code", sa.Text(), nullable=False),
        sa.Column("titre", sa.Text(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "modules_acs",
        sa.Column("module_id", sa.Integer(), nullable=True),
        sa.Column("ac_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ["ac_id"],
            ["app_crit.id"],
        ),
        sa.ForeignKeyConstraint(
            ["module_id"],
            ["notes_modules.id"],
        ),
    )
    op.create_table(
        "evaluation_ue_poids",
        sa.Column("evaluation_id", sa.Integer(), nullable=False),
        sa.Column("ue_id", sa.Integer(), nullable=False),
        sa.Column("poids", sa.Float(), nullable=False),
        sa.ForeignKeyConstraint(
            ["evaluation_id"],
            ["notes_evaluation.id"],
        ),
        sa.ForeignKeyConstraint(
            ["ue_id"],
            ["notes_ue.id"],
        ),
        sa.PrimaryKeyConstraint("evaluation_id", "ue_id"),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("evaluation_ue_poids")
    op.drop_table("modules_acs")
    op.drop_table("app_crit")
    # ### end Alembic commands ###
