From e2003eb9e315a8188065670399767816ec9ef110 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 15 Apr 2026 12:21:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=8D=A1=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=A3=80=E6=9F=A5=E8=BD=AE=E8=AF=A2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tb_polling_config 新增 card_status_check_interval INT NULL tb_iot_card 新增 last_card_status_check_at TIMESTAMPTZ NULL 含 IF NOT EXISTS 保证幂等,含完整回滚文件 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- migrations/000120_add_polling_card_status.down.sql | 5 +++++ migrations/000120_add_polling_card_status.up.sql | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 migrations/000120_add_polling_card_status.down.sql create mode 100644 migrations/000120_add_polling_card_status.up.sql diff --git a/migrations/000120_add_polling_card_status.down.sql b/migrations/000120_add_polling_card_status.down.sql new file mode 100644 index 0000000..03e4e49 --- /dev/null +++ b/migrations/000120_add_polling_card_status.down.sql @@ -0,0 +1,5 @@ +ALTER TABLE tb_polling_config + DROP COLUMN IF EXISTS card_status_check_interval; + +ALTER TABLE tb_iot_card + DROP COLUMN IF EXISTS last_card_status_check_at; diff --git a/migrations/000120_add_polling_card_status.up.sql b/migrations/000120_add_polling_card_status.up.sql new file mode 100644 index 0000000..a52e724 --- /dev/null +++ b/migrations/000120_add_polling_card_status.up.sql @@ -0,0 +1,13 @@ +-- 新增卡状态轮询相关列 +-- tb_polling_config 新增 card_status_check_interval:配置卡状态检查间隔(秒),NULL 表示不启用 +-- tb_iot_card 新增 last_card_status_check_at:记录最后一次卡状态检查时间,与其他 last_*_check_at 字段保持一致 + +ALTER TABLE tb_polling_config + ADD COLUMN IF NOT EXISTS card_status_check_interval INT NULL; + +COMMENT ON COLUMN tb_polling_config.card_status_check_interval IS '卡状态检查间隔(秒),NULL 表示不启用卡状态轮询'; + +ALTER TABLE tb_iot_card + ADD COLUMN IF NOT EXISTS last_card_status_check_at TIMESTAMPTZ NULL; + +COMMENT ON COLUMN tb_iot_card.last_card_status_check_at IS '最后一次卡状态检查时间';