From 08eca779084a82643e27aba15d64df9393dedf11 Mon Sep 17 00:00:00 2001 From: liulin <lin.liu@aliyun.com> Date: 星期六, 03 八月 2024 22:36:38 +0800 Subject: [PATCH] mysql迁移数据库到gauss --- sql/init.sql | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/init.sql b/sql/init.sql index 73c01d5..70b33fa 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -1,7 +1,7 @@ CREATE OR REPLACE FUNCTION "public"."update_timestamp_column"() RETURNS "pg_catalog"."trigger" AS $BODY$ BEGIN -NEW.timestamp_column := current_timestamp; +NEW.update_time := current_timestamp; RETURN NEW; END; $BODY$ @@ -45,6 +45,6 @@ -- 索引 CREATE INDEX "IDX_test_info_create_time" ON "public"."test_info"("create_time"); -- 触发器:自动赋值最后更新时间 -CREATE TRIGGER "TG_test_info" BEFORE UPDATE OF "update_time" ON "public"."test_info" +CREATE TRIGGER "TG_test_info" BEFORE INSERT OR UPDATE OF "update_time" ON "public"."test_info" FOR EACH ROW EXECUTE PROCEDURE "public"."update_timestamp_column"(); -- Gitblit v1.9.3