mirror of
https://github.com/ChenXu233/nonebot_plugin_dialectlist.git
synced 2025-05-23 14:11:17 +00:00
🐛 fix: add migrations (#50)
This commit is contained in:
parent
aff02f2666
commit
0348a5d66c
61
nonebot_plugin_dialectlist/migrations/873ad3421460_.py
Normal file
61
nonebot_plugin_dialectlist/migrations/873ad3421460_.py
Normal file
@ -0,0 +1,61 @@
|
||||
"""empty message
|
||||
|
||||
迁移 ID: 873ad3421460
|
||||
父迁移:
|
||||
创建时间: 2025-03-29 14:30:11.910461
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "873ad3421460"
|
||||
down_revision: str | Sequence[str] | None = None
|
||||
branch_labels: str | Sequence[str] | None = ("nonebot_plugin_dialectlist",)
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade(name: str = "") -> None:
|
||||
if name:
|
||||
return
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table(
|
||||
"nonebot_plugin_dialectlist_messagecountcache",
|
||||
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column("time", sa.DateTime(), nullable=False),
|
||||
sa.Column("session_id", sa.Integer(), nullable=False),
|
||||
sa.Column("session_bnum", sa.Integer(), nullable=False),
|
||||
sa.PrimaryKeyConstraint(
|
||||
"id", name=op.f("pk_nonebot_plugin_dialectlist_messagecountcache")
|
||||
),
|
||||
info={"bind_key": "nonebot_plugin_dialectlist"},
|
||||
)
|
||||
with op.batch_alter_table(
|
||||
"nonebot_plugin_dialectlist_messagecountcache", schema=None
|
||||
) as batch_op:
|
||||
batch_op.create_index(
|
||||
batch_op.f("ix_nonebot_plugin_dialectlist_messagecountcache_session_id"),
|
||||
["session_id"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade(name: str = "") -> None:
|
||||
if name:
|
||||
return
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table(
|
||||
"nonebot_plugin_dialectlist_messagecountcache", schema=None
|
||||
) as batch_op:
|
||||
batch_op.drop_index(
|
||||
batch_op.f("ix_nonebot_plugin_dialectlist_messagecountcache_session_id")
|
||||
)
|
||||
|
||||
op.drop_table("nonebot_plugin_dialectlist_messagecountcache")
|
||||
# ### end Alembic commands ###
|
Loading…
x
Reference in New Issue
Block a user