system-pri/backend/migrations/versions/64ad410af362_.py

65 lines
2.4 KiB
Python

"""empty message
Revision ID: 64ad410af362
Revises: ceaefb33117e
Create Date: 2022-10-27 09:44:53.799889
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '64ad410af362'
down_revision = 'ceaefb33117e'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('examination_schedules',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('title', sa.String(length=100), nullable=False),
sa.Column('mode', sa.Boolean(), nullable=False),
sa.Column('start_date', sa.DateTime(), nullable=True),
sa.Column('end_date', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('title')
)
op.create_table('enrollments',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('start_date', sa.DateTime(), nullable=False),
sa.Column('end_date', sa.DateTime(), nullable=False),
sa.Column('examination_schedule_id', sa.Integer(), nullable=True),
sa.Column('group_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['examination_schedule_id'], ['examination_schedules.id'], ),
sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('committees',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('enrollment_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['enrollment_id'], ['enrollments.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('committees_projects_supervisors',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('chairman', sa.Boolean(), nullable=False),
sa.Column('committee_id', sa.Integer(), nullable=True),
sa.Column('member_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['committee_id'], ['committees.id'], ),
sa.ForeignKeyConstraint(['member_id'], ['project_supervisors.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('committees_projects_supervisors')
op.drop_table('committees')
op.drop_table('enrollments')
op.drop_table('examination_schedules')
# ### end Alembic commands ###