ScoDoc-Lille/migrations/versions/dbcf2175e87f_modèles_assiduites_justificatifs.py

96 lines
3.0 KiB
Python
Raw Normal View History

2023-04-17 15:38:28 +02:00
"""modèles assiduites justificatifs
Revision ID: dbcf2175e87f
2023-06-20 08:33:49 +02:00
Revises: c701224fa255
2023-04-17 15:38:28 +02:00
Create Date: 2023-02-01 14:21:06.989190
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "dbcf2175e87f"
2023-06-20 15:50:56 +02:00
down_revision = "d84bc592584e"
2023-04-17 15:38:28 +02:00
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"justificatifs",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column(
"date_debut",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=False,
),
sa.Column(
"date_fin",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=False,
),
sa.Column("etudid", sa.Integer(), nullable=False),
sa.Column("etat", sa.Integer(), nullable=False),
sa.Column(
"entry_date",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=True,
),
sa.Column("raison", sa.Text(), nullable=True),
sa.Column("fichier", sa.Text(), nullable=True),
sa.ForeignKeyConstraint(["etudid"], ["identite.id"], ondelete="CASCADE"),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_justificatifs_etudid"), "justificatifs", ["etudid"], unique=False
)
op.create_table(
"assiduites",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column(
"date_debut",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=False,
),
sa.Column(
"date_fin",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=False,
),
sa.Column("moduleimpl_id", sa.Integer(), nullable=True),
sa.Column("etudid", sa.Integer(), nullable=False),
sa.Column("etat", sa.Integer(), nullable=False),
sa.Column("desc", sa.Text(), nullable=True),
sa.Column(
"entry_date",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=True,
),
sa.ForeignKeyConstraint(["etudid"], ["identite.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(
["moduleimpl_id"], ["notes_moduleimpl.id"], ondelete="SET NULL"
),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_assiduites_etudid"), "assiduites", ["etudid"], unique=False
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_assiduites_etudid"), table_name="assiduites")
op.drop_table("assiduites")
op.drop_index(op.f("ix_justificatifs_etudid"), table_name="justificatifs")
op.drop_table("justificatifs")
# ### end Alembic commands ###