From d186b4ef0f627d60c4bfca5e0862cf40585a5cb3 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 18 Sep 2026 13:24:03 +0800 Subject: [PATCH] =?UTF-8?q?migrate(m0039):=20expired=5Fat=E5=88=97?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=94=B9NOW()+7d+=E5=AD=98=E9=87=8Fpending?= =?UTF-8?q?=E8=A1=A5=E6=9C=9F(2026-09-18=E9=93=B6=E8=81=94=E4=BA=8B?= =?UTF-8?q?=E6=95=85=E5=9C=B0=E9=9B=B7:=E5=88=9B=E5=BB=BA=E5=8D=B3?= =?UTF-8?q?=E8=BF=87=E6=9C=9F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../m0039_human_tasks_expired_at.json | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 deploy/migrations/m0039_human_tasks_expired_at.json diff --git a/deploy/migrations/m0039_human_tasks_expired_at.json b/deploy/migrations/m0039_human_tasks_expired_at.json new file mode 100644 index 0000000..3361f90 --- /dev/null +++ b/deploy/migrations/m0039_human_tasks_expired_at.json @@ -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" + } + ] +}