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-07-23 20:35:42 +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
|
|
|
|
|
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
|
|
|
2022-07-23 20:35:42 +02:00
|
|
|
from alembic import op
|
2022-06-17 01:36:47 +02:00
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
2022-07-23 20:35:42 +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! ###
|
2022-07-23 20:35:42 +02:00
|
|
|
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),
|
|
|
|
sa.Column("log_announcements", sa.Boolean(), nullable=False),
|
|
|
|
sa.PrimaryKeyConstraint("course_id"),
|
|
|
|
sa.UniqueConstraint("code"),
|
|
|
|
sa.UniqueConstraint("name"),
|
2022-06-17 01:36:47 +02:00
|
|
|
)
|
2022-07-23 20:35:42 +02:00
|
|
|
op.create_table(
|
|
|
|
"ufora_announcements",
|
|
|
|
sa.Column("announcement_id", sa.Integer(), nullable=False),
|
|
|
|
sa.Column("course_id", sa.Integer(), nullable=True),
|
|
|
|
sa.Column("publication_date", sa.Date, nullable=True),
|
|
|
|
sa.ForeignKeyConstraint(
|
|
|
|
["course_id"],
|
|
|
|
["ufora_courses.course_id"],
|
|
|
|
),
|
|
|
|
sa.PrimaryKeyConstraint("announcement_id"),
|
2022-06-17 01:36:47 +02:00
|
|
|
)
|
2022-07-23 20:35:42 +02:00
|
|
|
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"),
|
2022-06-17 01:36:47 +02:00
|
|
|
)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade() -> None:
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
2022-07-23 20:35:42 +02:00
|
|
|
op.drop_table("ufora_course_aliases")
|
|
|
|
op.drop_table("ufora_announcements")
|
|
|
|
op.drop_table("ufora_courses")
|
2022-06-17 01:36:47 +02:00
|
|
|
# ### end Alembic commands ###
|