美化表格
This commit is contained in:
@@ -94,6 +94,19 @@ def init_database_tables():
|
||||
execute_update(create_sum_data_table)
|
||||
print("[数据库] t_daily_report_sum_data 表已就绪")
|
||||
|
||||
# 给配置表增加 show_monthly_total 字段
|
||||
try:
|
||||
execute_update(
|
||||
"ALTER TABLE t_daily_report_config ADD COLUMN show_monthly_total TINYINT NULL COMMENT '是否显示当月充电量总计' "
|
||||
)
|
||||
print("[数据库] 配置表新增 show_monthly_total 字段成功")
|
||||
except Exception as e:
|
||||
# 字段已存在会报错,忽略
|
||||
if "Duplicate" in str(e) or "duplicate" in str(e) or "Exists" in str(e) or "exists" in str(e):
|
||||
pass
|
||||
else:
|
||||
print(f"[数据库] 新增 show_monthly_total 字段时出错(可能已存在): {e}")
|
||||
|
||||
# 数据迁移:给 sort_order 为 NULL 的配置记录按 id 顺序赋值
|
||||
try:
|
||||
null_count = execute_query(
|
||||
|
||||
Reference in New Issue
Block a user