add
This commit is contained in:
@@ -7,8 +7,8 @@ create.py - 动态生成PostgreSQL建表SQL语句
|
||||
import os
|
||||
import re
|
||||
|
||||
# 1. 定义表名称变量,方便调整
|
||||
table_name = "cn_pmi_234_aaarecords" # 可以根据需要修改表名
|
||||
# 从环境变量获取表名,如果没有设置则使用默认值
|
||||
table_name = os.environ.get('TABLE_NAME', 'cn_pmi_234_aaarecords')
|
||||
|
||||
# 2. 定义SQL模板
|
||||
sql_template = f"""DO $$
|
||||
@@ -69,7 +69,7 @@ def update_sql_file():
|
||||
with open(sql_file_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# 查找插入位置(在\"部署完成\"日志前)
|
||||
# 查找插入位置(在"部署完成"日志前)
|
||||
insert_pattern = r'(DO \$\$.*?RAISE NOTICE \'🚀============ 数据库表部署开始 ============🚀\'.*?END \$\$;)(.*?)(DO \$\$.*?RAISE NOTICE \'============ 数据库表部署完成 ============\'.*?END \$\$;)'
|
||||
|
||||
match = re.search(insert_pattern, content, re.DOTALL)
|
||||
|
||||
Reference in New Issue
Block a user