system-pri/backend/migrations/versions/97c55960cd98_.py

64 lines
2.3 KiB
Python

"""empty message
Revision ID: 97c55960cd98
Revises: ceaefb33117e
Create Date: 2022-10-26 13:00:18.439990
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '97c55960cd98'
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'], 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 ###