pipeline-app/deploy/migrations/m0041_human_tasks_expired_at.json

23 lines
1.0 KiB
JSON

{
"id": "m0041",
"title": "修 pipeline_human_tasks.expired_at 创建即过期地雷(2026-09-18 银联事故实锤): 列 DDL 默认 current_timestamp() 而两处 create_human_task 均不显式写 → 实测全部历史待办 expired_at==created_at(创建瞬间过期)。本迁移①列默认改为 NOW()+7 天(MariaDB 10.6 支持表达式默认)②存量 pending 待办 expired_at 补为 created_at+7 天。代码侧两处 create_human_task 同步显式写 expired_at(双保险,不依赖列默认)",
"backup_tables": [
"pipeline_human_tasks"
],
"up": [
{
"op": "sql",
"sql": "ALTER TABLE pipeline_human_tasks MODIFY expired_at TIMESTAMP NOT NULL DEFAULT (CURRENT_TIMESTAMP + INTERVAL 7 DAY)"
},
{
"op": "sql",
"sql": "UPDATE pipeline_human_tasks SET expired_at = created_at + INTERVAL 7 DAY WHERE status='pending' AND expired_at <= created_at"
}
],
"down": [
{
"op": "sql",
"sql": "ALTER TABLE pipeline_human_tasks MODIFY expired_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"
}
]
}