didier/alembic/versions/09128b6e34dd_migrate_to_2_x.py

95 lines
4.1 KiB
Python
Raw Normal View History

2023-07-07 16:23:36 +02:00
"""Migrate to 2.x
Revision ID: 09128b6e34dd
Revises: 1e3e7f4192c4
Create Date: 2023-07-07 16:23:15.990231
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "09128b6e34dd"
down_revision = "1e3e7f4192c4"
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("bank", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=False)
with op.batch_alter_table("birthdays", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=False)
with op.batch_alter_table("bookmarks", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=False)
with op.batch_alter_table("command_stats", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=False)
with op.batch_alter_table("custom_command_aliases", schema=None) as batch_op:
batch_op.alter_column("command_id", existing_type=sa.INTEGER(), nullable=False)
with op.batch_alter_table("deadlines", schema=None) as batch_op:
batch_op.alter_column("course_id", existing_type=sa.INTEGER(), nullable=False)
with op.batch_alter_table("github_links", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=False)
with op.batch_alter_table("nightly_data", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=False)
with op.batch_alter_table("reminders", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=False)
with op.batch_alter_table("ufora_announcements", schema=None) as batch_op:
batch_op.alter_column("course_id", existing_type=sa.INTEGER(), nullable=False)
batch_op.alter_column("publication_date", existing_type=sa.DATE(), nullable=False)
with op.batch_alter_table("ufora_course_aliases", schema=None) as batch_op:
batch_op.alter_column("course_id", existing_type=sa.INTEGER(), nullable=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("ufora_course_aliases", schema=None) as batch_op:
batch_op.alter_column("course_id", existing_type=sa.INTEGER(), nullable=True)
with op.batch_alter_table("ufora_announcements", schema=None) as batch_op:
batch_op.alter_column("publication_date", existing_type=sa.DATE(), nullable=True)
batch_op.alter_column("course_id", existing_type=sa.INTEGER(), nullable=True)
with op.batch_alter_table("reminders", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=True)
with op.batch_alter_table("nightly_data", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=True)
with op.batch_alter_table("github_links", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=True)
with op.batch_alter_table("deadlines", schema=None) as batch_op:
batch_op.alter_column("course_id", existing_type=sa.INTEGER(), nullable=True)
with op.batch_alter_table("custom_command_aliases", schema=None) as batch_op:
batch_op.alter_column("command_id", existing_type=sa.INTEGER(), nullable=True)
with op.batch_alter_table("command_stats", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=True)
with op.batch_alter_table("bookmarks", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=True)
with op.batch_alter_table("birthdays", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=True)
with op.batch_alter_table("bank", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.BIGINT(), nullable=True)
# ### end Alembic commands ###