"""index on validations

Revision ID: 730ac71eea23
Revises: 92789d50f6b6
Create Date: 2021-12-09 23:58:51.162711

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "730ac71eea23"
down_revision = "92789d50f6b6"
branch_labels = None
depends_on = None


def upgrade():
    # Met à "STANDARD" (0) le type des modules sans types
    op.execute("UPDATE notes_modules set module_type = 0 where module_type is NULL;")
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index(
        op.f("ix_notes_formsemestre_etapes_etape_apo"),
        "notes_formsemestre_etapes",
        ["etape_apo"],
        unique=False,
    )
    op.create_index(
        op.f("ix_scolar_formsemestre_validation_code"),
        "scolar_formsemestre_validation",
        ["code"],
        unique=False,
    )
    op.create_index(
        op.f("ix_scolar_formsemestre_validation_etudid"),
        "scolar_formsemestre_validation",
        ["etudid"],
        unique=False,
    )
    op.create_index(
        op.f("ix_scolar_formsemestre_validation_formsemestre_id"),
        "scolar_formsemestre_validation",
        ["formsemestre_id"],
        unique=False,
    )
    op.create_index(
        op.f("ix_scolar_formsemestre_validation_ue_id"),
        "scolar_formsemestre_validation",
        ["ue_id"],
        unique=False,
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(
        op.f("ix_scolar_formsemestre_validation_ue_id"),
        table_name="scolar_formsemestre_validation",
    )
    op.drop_index(
        op.f("ix_scolar_formsemestre_validation_formsemestre_id"),
        table_name="scolar_formsemestre_validation",
    )
    op.drop_index(
        op.f("ix_scolar_formsemestre_validation_etudid"),
        table_name="scolar_formsemestre_validation",
    )
    op.drop_index(
        op.f("ix_scolar_formsemestre_validation_code"),
        table_name="scolar_formsemestre_validation",
    )
    op.drop_index(
        op.f("ix_notes_formsemestre_etapes_etape_apo"),
        table_name="notes_formsemestre_etapes",
    )
    # ### end Alembic commands ###
