From a4315b8f6fdf20dfb8bb1a0b9d15759d75044b98 Mon Sep 17 00:00:00 2001 From: jiangdingxuan Date: Mon, 8 Jan 2024 15:30:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87=20Liquibase=20=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=95=B0=E6=8D=AE=E5=BA=93=E7=89=88=E6=9C=AC=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/system/pom.xml | 6 ++++++ .../src/main/resources/config/application.yml | 2 ++ .../resources/db/changelog/db.changelog-master.yaml | 3 +++ .../src/main/resources/db/changelog/sql/dict.sql | 13 +++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 service/system/src/main/resources/db/changelog/db.changelog-master.yaml create mode 100644 service/system/src/main/resources/db/changelog/sql/dict.sql diff --git a/service/system/pom.xml b/service/system/pom.xml index 5843d8a..0b490c7 100644 --- a/service/system/pom.xml +++ b/service/system/pom.xml @@ -18,4 +18,10 @@ 4567 + + + org.liquibase + liquibase-core + + diff --git a/service/system/src/main/resources/config/application.yml b/service/system/src/main/resources/config/application.yml index 8e7d599..24b174d 100644 --- a/service/system/src/main/resources/config/application.yml +++ b/service/system/src/main/resources/config/application.yml @@ -19,3 +19,5 @@ spring: maximum-pool-size: 20 idle-timeout: 30000 max-lifetime: 1800000 + liquibase: + change-log: classpath:/db/changelog/db.changelog-master.yaml diff --git a/service/system/src/main/resources/db/changelog/db.changelog-master.yaml b/service/system/src/main/resources/db/changelog/db.changelog-master.yaml new file mode 100644 index 0000000..062d441 --- /dev/null +++ b/service/system/src/main/resources/db/changelog/db.changelog-master.yaml @@ -0,0 +1,3 @@ +databaseChangeLog: + - includeAll: + path: db/changelog/sql diff --git a/service/system/src/main/resources/db/changelog/sql/dict.sql b/service/system/src/main/resources/db/changelog/sql/dict.sql new file mode 100644 index 0000000..fa331fc --- /dev/null +++ b/service/system/src/main/resources/db/changelog/sql/dict.sql @@ -0,0 +1,13 @@ +create table dict +( + id varchar(64) not null comment '字典主键', + label varchar(255) not null comment '字典标签', + value varchar(255) not null comment '字典键值', + type varchar(255) not null comment '字典类型', + sort int default 1 not null comment '字典排序', + disabled bool default false not null comment '是否停用', + parent_id varchar(64) default 0 not null comment '父级字典主键', + constraint table_name_pk primary key (id), + constraint table_name_uk_type_value unique (type, value) +) comment '字典'; +