From 2f0370645ddd5cabfecd77238f6e38c05cd6a466 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期四, 19 九月 2024 08:06:29 +0800
Subject: [PATCH] liquibase使用说明:1、changeset zsh:20240904003    设置创建者及序号id(唯一不能重复)                 preconditions onFail:CONTINUE onError:CONTINUE  设置异常错误规则                 precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM sys_dict_type  设置sql执行的前置条件,符合执行,不符合直接结束                 2、建表sql判断表是否存在需要在表名的基础上加库限制:SELECT count(1) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'raw_glass_storage_station' and table_schema = 'hangzhoumes';  防止因为同一连接其他库已有该表造成无法创建表或者重复建表的情况发生。

---
 hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/changelog.sql |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/changelog.sql b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/changelog.sql
index 64764d3..245a94c 100644
--- a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/changelog.sql
+++ b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/changelog.sql
@@ -2,7 +2,7 @@
 
 -- changeset zsh:20240904001
 -- preconditions onFail:CONTINUE onError:CONTINUE
--- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sys_dict_type';
+-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sys_dict_type' and table_schema = 'hangzhoumes';
 CREATE TABLE sys_dict_type
 (
     dict_id     INT AUTO_INCREMENT PRIMARY KEY,
@@ -17,7 +17,7 @@
 
 -- changeset zsh:20240904002
 -- preconditions onFail:CONTINUE onError:CONTINUE
--- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sys_dict_data';
+-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sys_dict_data' and table_schema = 'hangzhoumes';
 CREATE TABLE sys_dict_data
 (
     dict_id         INT AUTO_INCREMENT PRIMARY KEY,
@@ -155,27 +155,25 @@
 
 -- changeset wangfei:20240918001
 -- preconditions onFail:CONTINUE onError:CONTINUE
--- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'raw_glass_storage_details';
+-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'raw_glass_storage_details' and table_schema = 'hangzhoumes';
 CREATE TABLE raw_glass_storage_details
 (
-    id            bigint NOT NULL AUTO_INCREMENT,
-    device_id     int NULL DEFAULT NULL COMMENT '璁惧id',
-    slot_id       varchar(255) NULL DEFAULT NULL COMMENT '鏍煎瓙id',
-    pattern_width double(8, 2
-) NULL DEFAULT NULL COMMENT '鍘熺墖瀹�',
-    pattern_height double(8, 2) NULL DEFAULT NULL COMMENT '鍘熺墖楂�',
+    id                bigint       NOT NULL AUTO_INCREMENT,
+    device_id         int          NULL DEFAULT NULL COMMENT '璁惧id',
+    slot_id           varchar(255) NULL DEFAULT NULL COMMENT '鏍煎瓙id',
+    pattern_width     double(8, 2) NULL DEFAULT NULL COMMENT '鍘熺墖瀹�',
+    pattern_height    double(8, 2) NULL DEFAULT NULL COMMENT '鍘熺墖楂�',
     pattern_thickness double(8, 2) NULL DEFAULT NULL COMMENT '鍘熺墖鍘氬害',
-    films_id varchar(255)  NULL DEFAULT NULL COMMENT '鑶滅郴',
-    create_time datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
-    remain_quantity varchar(255)  NULL DEFAULT NULL COMMENT '鍓╀綑鏁伴噺',
+    films_id          varchar(255) NULL DEFAULT NULL COMMENT '鑶滅郴',
+    create_time       datetime     NOT NULL COMMENT '鍒涘缓鏃堕棿',
+    remain_quantity   varchar(255) NULL DEFAULT NULL COMMENT '鍓╀綑鏁伴噺',
     PRIMARY KEY (id) USING BTREE
 );
 -- rollback DROP TABLE raw_glass_storage_details;
 
-
 -- changeset wangfei:20240918002
 -- preconditions onFail:CONTINUE onError:CONTINUE
--- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'raw_glass_storage_station';
+-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'raw_glass_storage_station' and table_schema = 'hangzhoumes';
 CREATE TABLE raw_glass_storage_station
 (
     id           bigint NOT NULL AUTO_INCREMENT,
@@ -191,7 +189,7 @@
 
 -- changeset wangfei:20240918003
 -- preconditions onFail:CONTINUE onError:CONTINUE
--- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'raw_glass_storage_task';
+-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'raw_glass_storage_task' and table_schema = 'hangzhoumes';
 CREATE TABLE raw_glass_storage_task
 (
     id               bigint NOT NULL AUTO_INCREMENT,

--
Gitblit v1.8.0