refactor: 彻底删除实际模块status字段
- 数据库: DROP project_finances.status 列(幂等迁移) - 后端: routes.py移除status过滤(12处), helpers.py修复SQL - 后端: 删除migrate_move_pending_to_plan, seed_data移除status - 前端: finance.js/performance.js/utils.js全部清除status引用 - finFilter默认值改为projects - 版本号 v1.0.0.23
This commit is contained in:
@@ -114,34 +114,3 @@ def migrate_fix_expense_status():
|
||||
conn.close()
|
||||
|
||||
|
||||
def migrate_move_pending_to_plan():
|
||||
"""迁移业务待签约项目到计划模块(幂等)"""
|
||||
from db import db
|
||||
|
||||
conn = db()
|
||||
try:
|
||||
cur = conn.cursor()
|
||||
# 获取 plan_finances 的列名(排除 status,因计划模块已删除该列)
|
||||
cur.execute("SHOW COLUMNS FROM plan_finances")
|
||||
plan_cols = [row[0] for row in cur.fetchall()]
|
||||
col_list = ", ".join(plan_cols)
|
||||
|
||||
# 仅迁移 id 不存在于计划表的待签约项目
|
||||
cur.execute(
|
||||
f"INSERT INTO plan_finances ({col_list}) "
|
||||
f"SELECT {col_list} FROM project_finances WHERE status='待签约' "
|
||||
f"AND id NOT IN (SELECT id FROM plan_finances)"
|
||||
)
|
||||
moved = cur.rowcount
|
||||
if moved:
|
||||
# 删除已迁移的原记录
|
||||
cur.execute(
|
||||
"DELETE FROM project_finances WHERE status='待签约' "
|
||||
"AND id IN (SELECT id FROM plan_finances)"
|
||||
)
|
||||
deleted = cur.rowcount
|
||||
conn.commit()
|
||||
print(f"[migrate] 待签约项目迁移到计划: {moved} 条 (已删除 {deleted} 条)")
|
||||
cur.close()
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user