migrate(m0039): expired_at列默认改NOW()+7d+存量pending补期(2026-09-18银联事故地雷:创建即过期)
This commit is contained in:
parent
2a2de5ba6e
commit
d186b4ef0f
21
deploy/migrations/m0039_human_tasks_expired_at.json
Normal file
21
deploy/migrations/m0039_human_tasks_expired_at.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"id": "m0039",
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user