didier/alembic/versions/4ec79dd5b191_initial_migrat...

55 lines
1.8 KiB
Python
Raw Normal View History

2022-06-19 00:36:38 +02:00
"""Initial migration
2022-06-17 01:36:47 +02:00
2022-06-19 00:36:38 +02:00
Revision ID: 4ec79dd5b191
2022-06-17 01:36:47 +02:00
Revises:
2022-06-19 00:36:38 +02:00
Create Date: 2022-06-19 00:31:58.384360
2022-06-17 01:36:47 +02:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
2022-06-19 00:36:38 +02:00
revision = '4ec79dd5b191'
2022-06-17 01:36:47 +02:00
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('ufora_courses',
sa.Column('course_id', sa.Integer(), nullable=False),
sa.Column('name', sa.Text(), nullable=False),
sa.Column('code', sa.Text(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
2022-06-19 00:36:38 +02:00
sa.Column('log_announcements', sa.Boolean(), nullable=False),
2022-06-17 01:36:47 +02:00
sa.PrimaryKeyConstraint('course_id'),
sa.UniqueConstraint('code'),
sa.UniqueConstraint('name')
)
op.create_table('ufora_announcements',
sa.Column('announcement_id', sa.Integer(), nullable=False),
sa.Column('course_id', sa.Integer(), nullable=True),
2022-06-19 00:36:38 +02:00
sa.Column('publication_date', sa.DateTime(timezone=True), nullable=True),
2022-06-17 01:36:47 +02:00
sa.ForeignKeyConstraint(['course_id'], ['ufora_courses.course_id'], ),
sa.PrimaryKeyConstraint('announcement_id')
)
op.create_table('ufora_course_aliases',
sa.Column('alias_id', sa.Integer(), nullable=False),
sa.Column('alias', sa.Text(), nullable=False),
sa.Column('course_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['course_id'], ['ufora_courses.course_id'], ),
sa.PrimaryKeyConstraint('alias_id'),
sa.UniqueConstraint('alias')
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('ufora_course_aliases')
op.drop_table('ufora_announcements')
op.drop_table('ufora_courses')
# ### end Alembic commands ###