nonebot-bison/nonebot_bison/config/migrations/5f3370328e44_add_time_weight_table.py
uy/sun 90816796c7
🚚 修改 nonebot_bison 项目结构 (#211)
* 🎨 修改 nonebot_bison 目录位置

* auto fix by pre-commit hooks

* 🚚 fix frontend build target

* 🚚 use soft link

* Revert "🚚 use soft link"

This reverts commit de21f79d5ae1bd5515b04f42a4138cb25ddf3e62.

* 🚚 modify dockerfile

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: felinae98 <731499577@qq.com>
2023-03-09 17:32:51 +08:00

52 lines
1.5 KiB
Python

"""add time-weight table
Revision ID: 5f3370328e44
Revises: a333d6224193
Create Date: 2022-05-31 22:05:13.235981
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "5f3370328e44"
down_revision = "a333d6224193"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"schedule_time_weight",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("target_id", sa.Integer(), nullable=True),
sa.Column("start_time", sa.Time(), nullable=True),
sa.Column("end_time", sa.Time(), nullable=True),
sa.Column("weight", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(
["target_id"],
["target.id"],
),
sa.PrimaryKeyConstraint("id"),
)
with op.batch_alter_table("target", schema=None) as batch_op:
batch_op.add_column(
sa.Column("default_schedule_weight", sa.Integer(), nullable=True)
)
batch_op.drop_column("last_schedule_time")
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("target", schema=None) as batch_op:
batch_op.add_column(
sa.Column("last_schedule_time", sa.DATETIME(), nullable=True)
)
batch_op.drop_column("default_schedule_weight")
op.drop_table("schedule_time_weight")
# ### end Alembic commands ###