细节修改
This commit is contained in:
@@ -34,6 +34,11 @@ def _add_column_if_not_exists(table_name, column_def_sql, column_name):
|
||||
return False
|
||||
|
||||
|
||||
def _set_table_comment(table_name, comment):
|
||||
"""设置表备注(Doris暂不支持通过SQL修改表注释,预留函数)"""
|
||||
pass
|
||||
|
||||
|
||||
def init_database_tables():
|
||||
"""初始化所有数据库表(应用启动时自动调用)"""
|
||||
try:
|
||||
@@ -64,6 +69,7 @@ def init_database_tables():
|
||||
PROPERTIES("replication_num" = "1")
|
||||
"""
|
||||
execute_update(create_config_table)
|
||||
_set_table_comment('t_daily_report_config', '日报配置表')
|
||||
log_info("[数据库] t_daily_report_config 表已就绪", 'db_init')
|
||||
|
||||
# 创建历史表
|
||||
@@ -90,6 +96,7 @@ def init_database_tables():
|
||||
PROPERTIES("replication_num" = "1")
|
||||
"""
|
||||
execute_update(create_history_table)
|
||||
_set_table_comment('t_daily_report_history', '日报生成历史记录表')
|
||||
log_info("[数据库] t_daily_report_history 表已就绪", 'db_init')
|
||||
|
||||
# 为已存在的表添加 config_name 字段(如果不存在)
|
||||
@@ -124,6 +131,7 @@ def init_database_tables():
|
||||
PROPERTIES("replication_num" = "1")
|
||||
"""
|
||||
execute_update(create_sum_data_table)
|
||||
_set_table_comment('t_daily_report_sum_data', '日报求和数据采集表')
|
||||
log_info("[数据库] t_daily_report_sum_data 表已就绪", 'db_init')
|
||||
|
||||
# 给配置表增加 show_monthly_total 字段
|
||||
@@ -176,5 +184,5 @@ def init_database_tables():
|
||||
log_info("[数据库] 初始化完成", 'db_init')
|
||||
return True
|
||||
except Exception as e:
|
||||
log_error(f"[数据库] 初始化失败: {e}", 'db_init')
|
||||
log_error(f"[数据库] 初始化失败: {e}", 'db_init', exc_info=True)
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user