mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-05 19:36:43 +08:00
🗃️ alter fields to not null, fix typing
This commit is contained in:
parent
88bb1d3698
commit
45b4ac3988
@ -137,8 +137,8 @@ async def get_subs_info(jwt_obj: dict = Depends(get_jwt_obj)) -> SubscribeResp:
|
|||||||
lambda sub: SubscribeConfig(
|
lambda sub: SubscribeConfig(
|
||||||
platformName=sub.target.platform_name,
|
platformName=sub.target.platform_name,
|
||||||
targetName=sub.target.target_name,
|
targetName=sub.target.target_name,
|
||||||
cats=sub.categories, # type: ignore
|
cats=sub.categories,
|
||||||
tags=sub.tags, # type: ignore
|
tags=sub.tags,
|
||||||
target=sub.target.target,
|
target=sub.target.target,
|
||||||
),
|
),
|
||||||
raw_subs,
|
raw_subs,
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
"""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 ###
|
Loading…
x
Reference in New Issue
Block a user