ScoDoc-PE/migrations/versions/943eb2deb22e_modèle_assiduites_et_justificatifs.py
iziram 02ec55ca18 - Modifi comportement Batch
- Ajout description assiduite
2023-01-30 15:12:31 +01:00

56 lines
2.3 KiB
Python

"""Modèle Assiduites et Justificatifs
Revision ID: 943eb2deb22e
Revises: 25e3ca6cc063
Create Date: 2023-01-30 14:08:47.214916
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '943eb2deb22e'
down_revision = '25e3ca6cc063'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('justificatifs',
sa.Column('justif_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=True),
sa.Column('raison', sa.Text(), nullable=True),
sa.Column('fichier', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['etudid'], ['identite.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('justif_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.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 ###