nonebot-bison/nonebot_bison/config/migrations/aceef470d69c_alter_fields_not_null.py
pre-commit-ci[bot] f6ee4a4c1b
⬆️ auto update by pre-commit hooks (#416)
* ⬆️ auto update by pre-commit hooks

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.1.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.292...v0.1.9)
- [github.com/pycqa/isort: 5.12.0 → 5.13.2](https://github.com/pycqa/isort/compare/5.12.0...5.13.2)
- [github.com/psf/black: 23.9.1 → 23.12.1](https://github.com/psf/black/compare/23.9.1...23.12.1)
- [github.com/pre-commit/mirrors-prettier: v3.0.3 → v4.0.0-alpha.8](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.3...v4.0.0-alpha.8)
- [github.com/pre-commit/mirrors-eslint: v8.50.0 → v9.0.0-alpha.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.50.0...v9.0.0-alpha.0)

* 💄 auto fix by pre-commit hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-02 10:24:42 +08:00

53 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 ###