From 118a55b04ea64f0606cb3e297da124625b333460 Mon Sep 17 00:00:00 2001 From: wangzhibiao Date: Mon, 14 Sep 2026 18:22:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=EF=BC=9A=E8=A1=A5=E9=BD=90Kingbase=E6=93=8D=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=80=97=E6=97=B6=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kingbase/001_sys_oper_log_cost_time.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 RuoYi-Vue/sql/system/kingbase/001_sys_oper_log_cost_time.sql diff --git a/RuoYi-Vue/sql/system/kingbase/001_sys_oper_log_cost_time.sql b/RuoYi-Vue/sql/system/kingbase/001_sys_oper_log_cost_time.sql new file mode 100644 index 000000000..ebb6330fa --- /dev/null +++ b/RuoYi-Vue/sql/system/kingbase/001_sys_oper_log_cost_time.sql @@ -0,0 +1,17 @@ +-- ============================================================================== +-- RailwaySystem 数据库迁移脚本: 001_sys_oper_log_cost_time.sql +-- 适用数据库: KingbaseES V009R003C018 (schema: public) +-- 执行目标: 为系统操作日志表 sys_oper_log 补齐缺失的 cost_time 字段 +-- 字段对齐: Java SysOperLog.costTime (Long) -> BIGINT DEFAULT 0 +-- 幂等机制: ADD COLUMN IF NOT EXISTS 语法级存在性保护 +-- 数据安全: 零清空、零删表,保留全部历史数据,旧数据默认赋 0 +-- ============================================================================== + +-- 1. 显式添加 cost_time 字段(若不存在),设置默认值为 0 +ALTER TABLE public.sys_oper_log ADD COLUMN IF NOT EXISTS cost_time BIGINT DEFAULT 0; + +-- 2. 设置列注释 +COMMENT ON COLUMN public.sys_oper_log.cost_time IS '消耗时间'; + +-- 3. 对已有存量数据(若为 NULL)补偿初始化为 0 +UPDATE public.sys_oper_log SET cost_time = 0 WHERE cost_time IS NULL;