This is an automated email from the ASF dual-hosted git repository.
alextang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new c69d8d8 [type: refactor] Remove selector and rule name as unique name
in sql (#2160)
c69d8d8 is described below
commit c69d8d84a0c64eb5115249d6da8edfc37837a0c8
Author: xiaoyu <[email protected]>
AuthorDate: Tue Sep 28 13:06:57 2021 +0800
[type: refactor] Remove selector and rule name as unique name in sql (#2160)
---
shenyu-admin/src/main/resources/sql-script/h2/schema.sql | 6 ++----
shenyu-admin/src/main/resources/sql-script/mysql/schema.sql | 6 ++----
shenyu-admin/src/main/resources/sql-script/pg/schema.sql | 9 ++++-----
3 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
index 13272e8..bf1b2ad 100644
--- a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
+++ b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
@@ -70,8 +70,7 @@ CREATE TABLE IF NOT EXISTS `selector` (
`loged` tinyint(4) NOT NULL COMMENT 'whether to print the log',
`continued` tinyint(4) NOT NULL COMMENT 'whether to continue execution',
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create
time',
- `date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP COMMENT 'update time',
- UNIQUE KEY(`name`)
+ `date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP COMMENT 'update time'
);
/*Table structure for table `selector_condition` */
@@ -98,8 +97,7 @@ CREATE TABLE IF NOT EXISTS `rule` (
`sort` int(4) NOT NULL COMMENT 'sort',
`handle` varchar(1024) DEFAULT NULL COMMENT 'processing logic (here for
different plug-ins, there will be different fields to identify different
processes, all data in JSON format is stored)',
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create
time',
- `date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP COMMENT 'update time',
- UNIQUE KEY (`name`)
+ `date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP COMMENT 'update time'
);
CREATE TABLE IF NOT EXISTS `rule_condition` (
diff --git a/shenyu-admin/src/main/resources/sql-script/mysql/schema.sql
b/shenyu-admin/src/main/resources/sql-script/mysql/schema.sql
index a8c0c40..7ce5da7 100644
--- a/shenyu-admin/src/main/resources/sql-script/mysql/schema.sql
+++ b/shenyu-admin/src/main/resources/sql-script/mysql/schema.sql
@@ -73,8 +73,7 @@ CREATE TABLE IF NOT EXISTS `selector` (
`loged` tinyint(4) NOT NULL COMMENT 'whether to print the log',
`continued` tinyint(4) NOT NULL COMMENT 'whether to continue execution',
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create
time',
- `date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP COMMENT 'update time',
- constraint unique_name unique (`name`)
+ `date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP COMMENT 'update time'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Table structure for table `selector_condition` */
@@ -101,8 +100,7 @@ CREATE TABLE IF NOT EXISTS `rule` (
`sort` int(4) NOT NULL COMMENT 'sort',
`handle` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT
'processing logic (here for different plug-ins, there will be different fields
to identify different processes, all data in JSON format is stored)',
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create
time',
- `date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP COMMENT 'update time',
- constraint unique_name unique (`name`)
+ `date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP COMMENT 'update time'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `rule_condition` (
diff --git a/shenyu-admin/src/main/resources/sql-script/pg/schema.sql
b/shenyu-admin/src/main/resources/sql-script/pg/schema.sql
index 94aa910..b0256fb 100644
--- a/shenyu-admin/src/main/resources/sql-script/pg/schema.sql
+++ b/shenyu-admin/src/main/resources/sql-script/pg/schema.sql
@@ -1295,11 +1295,6 @@ ELSE
-- ----------------------------
PERFORM public.dblink_exec('init_conn', 'ALTER TABLE "rule" ADD
CONSTRAINT "rule_pkey" PRIMARY KEY ("id");');
-- ----------------------------
- -- Indexes structure for table rule
- -- ----------------------------
- PERFORM public.dblink_exec('init_conn', 'CREATE INDEX "unique_name" ON
"rule" USING btree (
- "name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC
NULLS LAST
- );');
PERFORM public.dblink_exec('init_conn', 'COMMIT');
END IF;
@@ -1376,6 +1371,10 @@ ELSE
PERFORM public.dblink_exec('init_conn', ' CREATE TRIGGER
selector_tigger
BEFORE UPDATE ON selector
FOR EACH ROW EXECUTE PROCEDURE update_timestamp()');
+ -- Primary Key structure for table selector
+ -- ----------------------------
+ PERFORM public.dblink_exec('init_conn', 'ALTER TABLE "selector" ADD
CONSTRAINT "selector_pkey" PRIMARY KEY ("id");');
+ -- ----------------------------
PERFORM public.dblink_exec('init_conn', 'COMMIT');
END IF;