Skip to content

Commit 032dddb

Browse files
🐛 修改用户唯一标识符字段长度
1 parent 6493aba commit 032dddb

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""modify field length
2+
3+
迁移 ID: 3588702dd3a4
4+
父迁移: bc6abd57928f
5+
创建时间: 2025-07-19 17:21:17.927162
6+
7+
"""
8+
9+
from __future__ import annotations
10+
11+
from typing import TYPE_CHECKING
12+
13+
import sqlalchemy as sa
14+
from alembic import op
15+
16+
if TYPE_CHECKING:
17+
from collections.abc import Sequence
18+
19+
revision: str = '3588702dd3a4'
20+
down_revision: str | Sequence[str] | None = 'bc6abd57928f'
21+
branch_labels: str | Sequence[str] | None = None
22+
depends_on: str | Sequence[str] | None = None
23+
24+
25+
def upgrade(name: str = '') -> None:
26+
if name:
27+
return
28+
# ### commands auto generated by Alembic - please adjust! ###
29+
with op.batch_alter_table('nb_t_tos_hist_data', schema=None) as batch_op:
30+
batch_op.alter_column(
31+
'user_unique_identifier',
32+
existing_type=sa.VARCHAR(length=24),
33+
type_=sa.String(length=256),
34+
existing_nullable=False,
35+
)
36+
37+
# ### end Alembic commands ###
38+
39+
40+
def downgrade(name: str = '') -> None:
41+
if name:
42+
return
43+
# ### commands auto generated by Alembic - please adjust! ###
44+
with op.batch_alter_table('nb_t_tos_hist_data', schema=None) as batch_op:
45+
batch_op.alter_column(
46+
'user_unique_identifier',
47+
existing_type=sa.String(length=256),
48+
type_=sa.VARCHAR(length=24),
49+
existing_nullable=False,
50+
)
51+
52+
# ### end Alembic commands ###

nonebot_plugin_tetris_stats/games/tos/api/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TOSHistoricalData(MappedAsDataclass, Model):
1414
__tablename__ = 'nb_t_tos_hist_data'
1515

1616
id: Mapped[int] = mapped_column(init=False, primary_key=True)
17-
user_unique_identifier: Mapped[str] = mapped_column(String(24), index=True)
17+
user_unique_identifier: Mapped[str] = mapped_column(String(256), index=True)
1818
api_type: Mapped[Literal['User Info', 'User Profile']] = mapped_column(String(16), index=True)
1919
data: Mapped[UserInfoSuccess | UserProfile] = mapped_column(
2020
PydanticType(get_model=[], models={UserInfoSuccess, UserProfile})

0 commit comments

Comments
 (0)