PaiGram/alembic/versions/89dcb9109475_tasks_daily.py
2024-03-10 20:10:25 +08:00

60 lines
1.5 KiB
Python

"""tasks_daily
Revision ID: 89dcb9109475
Revises: 27aaa52f9d4a
Create Date: 2024-03-10 10:48:10.227236
"""
from alembic import op
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = "89dcb9109475"
down_revision = "27aaa52f9d4a"
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"task",
"type",
existing_type=mysql.ENUM(
"SIGN",
"RESIN",
"REALM",
"EXPEDITION",
"TRANSFORMER",
"CARD",
"DAILY",
collation="utf8mb4_general_ci",
),
nullable=False,
)
op.drop_index("task_1", table_name="task")
op.create_index(op.f("ix_task_user_id"), "task", ["user_id"], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_task_user_id"), table_name="task")
op.create_index("task_1", "task", ["user_id"], unique=False)
op.alter_column(
"task",
"type",
existing_type=mysql.ENUM(
"SIGN",
"RESIN",
"REALM",
"EXPEDITION",
"TRANSFORMER",
"CARD",
collation="utf8mb4_general_ci",
),
nullable=True,
)
op.alter_column("task", "user_id", existing_type=mysql.BIGINT(), nullable=True)
# ### end Alembic commands ###