system-pri/backend/migrations/versions/9874e26f2b87_.py

64 lines
2.3 KiB
Python

"""empty message
Revision ID: 9874e26f2b87
Revises: ceaefb33117e
Create Date: 2022-10-26 09:46:09.397814
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9874e26f2b87'
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('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'], ),
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 ###