From 146cdd97d33f9a25596a3ce4c47962ac0148d323 Mon Sep 17 00:00:00 2001 From: Mengyi Zhou Date: Tue, 22 Sep 2015 18:16:41 +0800 Subject: [PATCH] update db to meet mysql requirements --- .../META-INF/dal/jdbc/core-codegen.xml | 50 +++++++++++++------ src/main/resources/sql/create-tables.sql | 6 ++- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/main/resources/META-INF/dal/jdbc/core-codegen.xml b/src/main/resources/META-INF/dal/jdbc/core-codegen.xml index 49813056..c9b56c0e 100644 --- a/src/main/resources/META-INF/dal/jdbc/core-codegen.xml +++ b/src/main/resources/META-INF/dal/jdbc/core-codegen.xml @@ -746,11 +746,11 @@ - + - - + + @@ -760,19 +760,25 @@ + - FROM ]]> + FROM
+ WHERE = ${key-vs-id}]]> () VALUES()]]> + - SET ]]> + SET + WHERE = ${key-vs-id}]]> - ]]> + + + WHERE = ${key-vs-id}]]> @@ -1105,10 +1111,12 @@ + - + + @@ -1119,27 +1127,35 @@ + - FROM
]]> + FROM
+ WHERE = ${key-id}]]> () VALUES()]]> + - SET ]]> + SET + WHERE = ${key-id}]]> - ]]> + + + WHERE = ${key-id}]]> + - + + @@ -1150,19 +1166,25 @@ + - FROM
]]> + FROM
+ WHERE = ${key-id}]]> () VALUES()]]> + - SET ]]> + SET + WHERE = ${key-id}]]> - ]]> + + + WHERE = ${key-id}]]> diff --git a/src/main/resources/sql/create-tables.sql b/src/main/resources/sql/create-tables.sql index b00874c6..75fc6105 100644 --- a/src/main/resources/sql/create-tables.sql +++ b/src/main/resources/sql/create-tables.sql @@ -335,7 +335,7 @@ CREATE TABLE IF NOT EXISTS `m_vs_content` ( `vs_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'vs_archive_id', `content` mediumtext NOT NULL COMMENT 'vs_archive_content', `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'last time modified', - UNIQUE KEY `vs_id` (`vs_id`), + PRIMARY KEY (`vs_id`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='metadata table of virtual server content'; @@ -497,9 +497,11 @@ CREATE TABLE IF NOT EXISTS `report` ( -- Dumping structure for table r_vs_domain DROP TABLE IF EXISTS `r_vs_domain`; CREATE TABLE IF NOT EXISTS `r_vs_domain` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'primary key', `vs_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'slb_virtual_server_id', `domain` varchar(200) NOT NULL DEFAULT 'Undefined' COMMENT 'slb_domain_name', `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'last time modified', + PRIMARY KEY (`id`), UNIQUE KEY `vs_id_domain` (`vs_id`,`domain`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='relation table of vs and domain'; @@ -510,9 +512,11 @@ CREATE TABLE IF NOT EXISTS `r_vs_domain` ( -- Dumping structure for table r_vs_slb DROP TABLE IF EXISTS `r_vs_slb`; CREATE TABLE IF NOT EXISTS `r_vs_slb` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'primary key', `vs_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'slb_virtual_server_id', `slb_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'slb_id', `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'last time modified', + PRIMARY KEY (`id`), UNIQUE KEY `slb_id_vs_id` (`slb_id`,`vs_id`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='relation table of slb and vs';