nonebot-bison/nonebot_bison/config/migrations/aceef470d69c_alter_fields_not_null.py
Azide e50eb5d70b 👷 添加ruff actions
🐛 分支应该是main而不是master

💄 auto fix by pre-commit hooks

🔥 dependabot.yml的registrys需要token,先删除
2023-07-18 21:43:25 +08:00

52 lines
2.2 KiB
Python

"""alter fields not null
Revision ID: aceef470d69c
Revises: bd92923c218f
Create Date: 2023-03-09 19:10:42.168133
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "aceef470d69c"
down_revision = "bd92923c218f"
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("nonebot_bison_scheduletimeweight", schema=None) as batch_op:
batch_op.alter_column("target_id", existing_type=sa.INTEGER(), nullable=False)
batch_op.alter_column("start_time", existing_type=sa.TIME(), nullable=False)
batch_op.alter_column("end_time", existing_type=sa.TIME(), nullable=False)
batch_op.alter_column("weight", existing_type=sa.INTEGER(), nullable=False)
with op.batch_alter_table("nonebot_bison_subscribe", schema=None) as batch_op:
batch_op.alter_column("target_id", existing_type=sa.INTEGER(), nullable=False)
batch_op.alter_column("user_id", existing_type=sa.INTEGER(), nullable=False)
with op.batch_alter_table("nonebot_bison_target", schema=None) as batch_op:
batch_op.alter_column("default_schedule_weight", existing_type=sa.INTEGER(), nullable=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("nonebot_bison_target", schema=None) as batch_op:
batch_op.alter_column("default_schedule_weight", existing_type=sa.INTEGER(), nullable=True)
with op.batch_alter_table("nonebot_bison_subscribe", schema=None) as batch_op:
batch_op.alter_column("user_id", existing_type=sa.INTEGER(), nullable=True)
batch_op.alter_column("target_id", existing_type=sa.INTEGER(), nullable=True)
with op.batch_alter_table("nonebot_bison_scheduletimeweight", schema=None) as batch_op:
batch_op.alter_column("weight", existing_type=sa.INTEGER(), nullable=True)
batch_op.alter_column("end_time", existing_type=sa.TIME(), nullable=True)
batch_op.alter_column("start_time", existing_type=sa.TIME(), nullable=True)
batch_op.alter_column("target_id", existing_type=sa.INTEGER(), nullable=True)
# ### end Alembic commands ###