fix(database): upgrade error in pg database

Co-Authored-By: Aqr-K <95741669+Aqr-K@users.noreply.github.com>
This commit is contained in:
DDSRem
2025-08-23 18:12:13 +08:00
co-authored by Aqr-K
parent e90359eb08
commit cb1dd9f17d
10 changed files with 143 additions and 57 deletions
+5 -1
View File
@@ -21,7 +21,11 @@ depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
# 站点数据统计增加站点名称
with contextlib.suppress(Exception):
conn = op.get_bind()
inspector = sa.inspect(conn)
columns = inspector.get_columns('siteuserdata')
# 检查 'name' 字段是否已存在
if not any(c['name'] == 'name' for c in columns):
op.add_column('siteuserdata', sa.Column('name', sa.String(), nullable=True))
# ### end Alembic commands ###