乐观锁、逻辑删除PostgreSQL数据库升级脚本

This commit is contained in:
dataprince 2024-01-08 15:51:13 +08:00
parent f2cad965fd
commit 741b4a842e

View File

@ -244,3 +244,50 @@ COMMENT ON COLUMN "mf_customer"."tenant_id" IS '租户编码';
ALTER TABLE "mf_goods" ADD "tenant_id" BIGINT NOT NULL DEFAULT '0';
COMMENT ON COLUMN "mf_goods"."tenant_id" IS '租户编码';
-- 添加乐观锁字段
ALTER TABLE "gen_table" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "gen_table"."version" IS '乐观锁';
ALTER TABLE "gen_table_column" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "gen_table_column"."version" IS '乐观锁';
ALTER TABLE "sys_client" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_client"."version" IS '乐观锁';
ALTER TABLE "sys_config" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_config"."version" IS '乐观锁';
ALTER TABLE "sys_dept" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_dept"."version" IS '乐观锁';
ALTER TABLE "sys_dict_data" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_dict_data"."version" IS '乐观锁';
ALTER TABLE "sys_dict_type" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_dict_type"."version" IS '乐观锁';
ALTER TABLE "sys_menu" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_menu"."version" IS '乐观锁';
ALTER TABLE "sys_notice" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_notice"."version" IS '乐观锁';
ALTER TABLE "sys_oss" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_oss"."version" IS '乐观锁';
ALTER TABLE "sys_oss_config" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_oss_config"."version" IS '乐观锁';
ALTER TABLE "sys_post" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_post"."version" IS '乐观锁';
ALTER TABLE "sys_role" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_role"."version" IS '乐观锁';
ALTER TABLE "sys_tenant" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_tenant"."version" IS '乐观锁';
ALTER TABLE "sys_tenant_package" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_tenant_package"."version" IS '乐观锁';
ALTER TABLE "sys_user" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "sys_user"."version" IS '乐观锁';
-- 演示示例增加乐观锁、逻辑删除字段
ALTER TABLE "mf_student" ADD "version" INTEGER NULL DEFAULT '0';
COMMENT ON COLUMN "mf_student"."version" IS '乐观锁';
ALTER TABLE "mf_student" ADD "del_flag" SMALLINT NULL DEFAULT '0';
COMMENT ON COLUMN "mf_student"."del_flag" IS '逻辑删除标志0代表存在 1代表删除';
ALTER TABLE "mf_product" ADD "version" INTEGER NOT NULL DEFAULT '0';
COMMENT ON COLUMN "mf_product"."version" IS '乐观锁';
ALTER TABLE "mf_product" ADD "del_flag" SMALLINT NOT NULL DEFAULT '0';
COMMENT ON COLUMN "mf_product"."del_flag" IS '逻辑删除标志0代表存在 1代表删除';
ALTER TABLE "mf_customer" ADD "version" INTEGER NOT NULL DEFAULT '0';
COMMENT ON COLUMN "mf_customer"."version" IS '乐观锁';
ALTER TABLE "mf_customer" ADD "del_flag" SMALLINT NOT NULL DEFAULT '0';
COMMENT ON COLUMN "mf_customer"."del_flag" IS '逻辑删除标志0代表存在 1代表删除';