mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
🐛 修改用户唯一标识符字段长度 (#549)
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
"""modify field length
|
||||||
|
|
||||||
|
迁移 ID: 3588702dd3a4
|
||||||
|
父迁移: bc6abd57928f
|
||||||
|
创建时间: 2025-07-19 17:21:17.927162
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Sequence
|
||||||
|
|
||||||
|
revision: str = '3588702dd3a4'
|
||||||
|
down_revision: str | Sequence[str] | None = 'bc6abd57928f'
|
||||||
|
branch_labels: str | Sequence[str] | None = None
|
||||||
|
depends_on: str | Sequence[str] | None = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade(name: str = '') -> None:
|
||||||
|
if name:
|
||||||
|
return
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('nb_t_tos_hist_data', schema=None) as batch_op:
|
||||||
|
batch_op.alter_column(
|
||||||
|
'user_unique_identifier',
|
||||||
|
existing_type=sa.VARCHAR(length=24),
|
||||||
|
type_=sa.String(length=256),
|
||||||
|
existing_nullable=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade(name: str = '') -> None:
|
||||||
|
if name:
|
||||||
|
return
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('nb_t_tos_hist_data', schema=None) as batch_op:
|
||||||
|
batch_op.alter_column(
|
||||||
|
'user_unique_identifier',
|
||||||
|
existing_type=sa.String(length=256),
|
||||||
|
type_=sa.VARCHAR(length=24),
|
||||||
|
existing_nullable=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
@@ -14,7 +14,7 @@ class TOSHistoricalData(MappedAsDataclass, Model):
|
|||||||
__tablename__ = 'nb_t_tos_hist_data'
|
__tablename__ = 'nb_t_tos_hist_data'
|
||||||
|
|
||||||
id: Mapped[int] = mapped_column(init=False, primary_key=True)
|
id: Mapped[int] = mapped_column(init=False, primary_key=True)
|
||||||
user_unique_identifier: Mapped[str] = mapped_column(String(24), index=True)
|
user_unique_identifier: Mapped[str] = mapped_column(String(256), index=True)
|
||||||
api_type: Mapped[Literal['User Info', 'User Profile']] = mapped_column(String(16), index=True)
|
api_type: Mapped[Literal['User Info', 'User Profile']] = mapped_column(String(16), index=True)
|
||||||
data: Mapped[UserInfoSuccess | UserProfile] = mapped_column(
|
data: Mapped[UserInfoSuccess | UserProfile] = mapped_column(
|
||||||
PydanticType(get_model=[], models={UserInfoSuccess, UserProfile})
|
PydanticType(get_model=[], models={UserInfoSuccess, UserProfile})
|
||||||
|
|||||||
Reference in New Issue
Block a user