From 21019018c93cb97c704ab92753c1c22dde4ba69d Mon Sep 17 00:00:00 2001 From: nisiyong Date: Thu, 19 May 2022 10:01:26 +0800 Subject: [PATCH 1/2] refactor: remove flyway (#4353) --- pom.xml | 54 --- .../configdb/V1.0.0__initialization.sql | 393 ------------------ scripts/flyway/configdb/V1.1.0__accesskey.sql | 36 -- .../flyway/configdb/V1.1.1__extend_appId.sql | 24 -- .../configdb/V1.1.2__extend_username.sql | 70 ---- .../configdb/V2.0.0__add-column-deletedat.sql | 58 --- .../configdb/V2.0.1__add-unique-key.sql | 76 ---- scripts/flyway/flyway-configdb.properties | 20 - scripts/flyway/flyway-portaldb.properties | 20 - .../portaldb/V1.0.0__initialization.sql | 345 --------------- .../flyway/portaldb/V1.1.1__extend_appId.sql | 20 - .../portaldb/V1.1.2__extend_username.sql | 62 --- .../V1.1.3__add_preferred_username.sql | 21 - .../V1.1.4__delegating-password-encoder.sql | 20 - .../flyway/portaldb/V1.1.5__jdbc-session.sql | 40 -- .../portaldb/V2.0.0__add-column-deletedat.sql | 51 --- .../portaldb/V2.0.1__add-unique-key.sql | 79 ---- 17 files changed, 1389 deletions(-) delete mode 100644 scripts/flyway/configdb/V1.0.0__initialization.sql delete mode 100644 scripts/flyway/configdb/V1.1.0__accesskey.sql delete mode 100644 scripts/flyway/configdb/V1.1.1__extend_appId.sql delete mode 100644 scripts/flyway/configdb/V1.1.2__extend_username.sql delete mode 100644 scripts/flyway/configdb/V2.0.0__add-column-deletedat.sql delete mode 100644 scripts/flyway/configdb/V2.0.1__add-unique-key.sql delete mode 100644 scripts/flyway/flyway-configdb.properties delete mode 100644 scripts/flyway/flyway-portaldb.properties delete mode 100644 scripts/flyway/portaldb/V1.0.0__initialization.sql delete mode 100644 scripts/flyway/portaldb/V1.1.1__extend_appId.sql delete mode 100644 scripts/flyway/portaldb/V1.1.2__extend_username.sql delete mode 100644 scripts/flyway/portaldb/V1.1.3__add_preferred_username.sql delete mode 100644 scripts/flyway/portaldb/V1.1.4__delegating-password-encoder.sql delete mode 100644 scripts/flyway/portaldb/V1.1.5__jdbc-session.sql delete mode 100644 scripts/flyway/portaldb/V2.0.0__add-column-deletedat.sql delete mode 100644 scripts/flyway/portaldb/V2.0.1__add-unique-key.sql diff --git a/pom.xml b/pom.xml index 3761cbe5ada..59ec0d3785d 100644 --- a/pom.xml +++ b/pom.xml @@ -687,60 +687,6 @@ - - configdb - - - - org.flywaydb - flyway-maven-plugin - 8.0.5 - - - mysql - mysql-connector-java - ${mysql-connector-java.version} - - - - - - scripts/flyway/flyway-configdb.properties - - - - false - - - - - - portaldb - - - - org.flywaydb - flyway-maven-plugin - 8.0.5 - - - mysql - mysql-connector-java - ${mysql-connector-java.version} - - - - - - scripts/flyway/flyway-portaldb.properties - - - - false - - - - diff --git a/scripts/flyway/configdb/V1.0.0__initialization.sql b/scripts/flyway/configdb/V1.0.0__initialization.sql deleted file mode 100644 index 044c0eeefdd..00000000000 --- a/scripts/flyway/configdb/V1.0.0__initialization.sql +++ /dev/null @@ -1,393 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - -# Create Database -# ------------------------------------------------------------ -CREATE DATABASE IF NOT EXISTS ApolloConfigDB DEFAULT CHARACTER SET = utf8mb4; - -Use ApolloConfigDB; - -# Dump of table app -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `App`; - -CREATE TABLE `App` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', - `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', - `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名', - `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id', - `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字', - `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName', - `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `AppId` (`AppId`(191)), - KEY `DataChange_LastTime` (`DataChange_LastTime`), - KEY `IX_Name` (`Name`(191)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用表'; - - - -# Dump of table appnamespace -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `AppNamespace`; - -CREATE TABLE `AppNamespace` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `Name` varchar(32) NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一', - `AppId` varchar(32) NOT NULL DEFAULT '' COMMENT 'app id', - `Format` varchar(32) NOT NULL DEFAULT 'properties' COMMENT 'namespace的format类型', - `IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace是否为公共', - `Comment` varchar(64) NOT NULL DEFAULT '' COMMENT '注释', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_AppId` (`AppId`), - KEY `Name_AppId` (`Name`,`AppId`), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义'; - - - -# Dump of table audit -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Audit`; - -CREATE TABLE `Audit` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', - `EntityName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '表名', - `EntityId` int(10) unsigned DEFAULT NULL COMMENT '记录ID', - `OpName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '操作类型', - `Comment` varchar(500) DEFAULT NULL COMMENT '备注', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='日志审计表'; - - - -# Dump of table cluster -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Cluster`; - -CREATE TABLE `Cluster` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `Name` varchar(32) NOT NULL DEFAULT '' COMMENT '集群名字', - `AppId` varchar(32) NOT NULL DEFAULT '' COMMENT 'App id', - `ParentClusterId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父cluster', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_AppId_Name` (`AppId`,`Name`), - KEY `IX_ParentClusterId` (`ParentClusterId`), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='集群'; - - - -# Dump of table commit -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Commit`; - -CREATE TABLE `Commit` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', - `ChangeSets` longtext NOT NULL COMMENT '修改变更集', - `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', - `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', - `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName', - `Comment` varchar(500) DEFAULT NULL COMMENT '备注', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `DataChange_LastTime` (`DataChange_LastTime`), - KEY `AppId` (`AppId`(191)), - KEY `ClusterName` (`ClusterName`(191)), - KEY `NamespaceName` (`NamespaceName`(191)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='commit 历史表'; - -# Dump of table grayreleaserule -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `GrayReleaseRule`; - -CREATE TABLE `GrayReleaseRule` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', - `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID', - `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name', - `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name', - `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'branch name', - `Rules` varchar(16000) DEFAULT '[]' COMMENT '灰度规则', - `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '灰度对应的release', - `BranchStatus` tinyint(2) DEFAULT '1' COMMENT '灰度分支状态: 0:删除分支,1:正在使用的规则 2:全量发布', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `DataChange_LastTime` (`DataChange_LastTime`), - KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='灰度规则表'; - - -# Dump of table instance -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Instance`; - -CREATE TABLE `Instance` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID', - `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', - `DataCenter` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Data Center Name', - `Ip` varchar(32) NOT NULL DEFAULT '' COMMENT 'instance ip', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - UNIQUE KEY `IX_UNIQUE_KEY` (`AppId`,`ClusterName`,`Ip`,`DataCenter`), - KEY `IX_IP` (`Ip`), - KEY `IX_DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='使用配置的应用实例'; - - - -# Dump of table instanceconfig -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `InstanceConfig`; - -CREATE TABLE `InstanceConfig` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `InstanceId` int(11) unsigned DEFAULT NULL COMMENT 'Instance Id', - `ConfigAppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config App Id', - `ConfigClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Cluster Name', - `ConfigNamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Namespace Name', - `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key', - `ReleaseDeliveryTime` timestamp NULL DEFAULT NULL COMMENT '配置获取时间', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - UNIQUE KEY `IX_UNIQUE_KEY` (`InstanceId`,`ConfigAppId`,`ConfigNamespaceName`), - KEY `IX_ReleaseKey` (`ReleaseKey`), - KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), - KEY `IX_Valid_Namespace` (`ConfigAppId`,`ConfigClusterName`,`ConfigNamespaceName`,`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用实例的配置信息'; - - - -# Dump of table item -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Item`; - -CREATE TABLE `Item` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId', - `Key` varchar(128) NOT NULL DEFAULT 'default' COMMENT '配置项Key', - `Value` longtext NOT NULL COMMENT '配置项值', - `Comment` varchar(1024) DEFAULT '' COMMENT '注释', - `LineNum` int(10) unsigned DEFAULT '0' COMMENT '行号', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_GroupId` (`NamespaceId`), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置项目'; - - - -# Dump of table namespace -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Namespace`; - -CREATE TABLE `Namespace` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', - `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name', - `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `AppId_ClusterName_NamespaceName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)), - KEY `DataChange_LastTime` (`DataChange_LastTime`), - KEY `IX_NamespaceName` (`NamespaceName`(191)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='命名空间'; - - - -# Dump of table namespacelock -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `NamespaceLock`; - -CREATE TABLE `NamespaceLock` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', - `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT 'default' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - `IsDeleted` bit(1) DEFAULT b'0' COMMENT '软删除', - PRIMARY KEY (`Id`), - UNIQUE KEY `IX_NamespaceId` (`NamespaceId`), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='namespace的编辑锁'; - - - -# Dump of table release -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Release`; - -CREATE TABLE `Release` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key', - `Name` varchar(64) NOT NULL DEFAULT 'default' COMMENT '发布名字', - `Comment` varchar(256) DEFAULT NULL COMMENT '发布说明', - `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', - `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', - `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName', - `Configurations` longtext NOT NULL COMMENT '发布配置', - `IsAbandoned` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否废弃', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `AppId_ClusterName_GroupName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)), - KEY `DataChange_LastTime` (`DataChange_LastTime`), - KEY `IX_ReleaseKey` (`ReleaseKey`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布'; - - -# Dump of table releasehistory -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `ReleaseHistory`; - -CREATE TABLE `ReleaseHistory` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID', - `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', - `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'namespaceName', - `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT '发布分支名', - `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '关联的Release Id', - `PreviousReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '前一次发布的ReleaseId', - `Operation` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '发布类型,0: 普通发布,1: 回滚,2: 灰度发布,3: 灰度规则更新,4: 灰度合并回主分支发布,5: 主分支发布灰度自动发布,6: 主分支回滚灰度自动发布,7: 放弃灰度', - `OperationContext` longtext NOT NULL COMMENT '发布上下文信息', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`,`BranchName`), - KEY `IX_ReleaseId` (`ReleaseId`), - KEY `IX_DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布历史'; - - -# Dump of table releasemessage -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `ReleaseMessage`; - -CREATE TABLE `ReleaseMessage` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `Message` varchar(1024) NOT NULL DEFAULT '' COMMENT '发布的消息内容', - `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `DataChange_LastTime` (`DataChange_LastTime`), - KEY `IX_Message` (`Message`(191)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布消息'; - - - -# Dump of table serverconfig -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `ServerConfig`; - -CREATE TABLE `ServerConfig` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key', - `Cluster` varchar(32) NOT NULL DEFAULT 'default' COMMENT '配置对应的集群,default为不针对特定的集群', - `Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值', - `Comment` varchar(1024) DEFAULT '' COMMENT '注释', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_Key` (`Key`), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置'; - -# Config -# ------------------------------------------------------------ -INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`, `Comment`) -VALUES - ('eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'), - ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'), - ('item.key.length.limit', 'default', '128', 'item key 最大长度限制'), - ('item.value.length.limit', 'default', '20000', 'item value最大长度限制'), - ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'); - -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/scripts/flyway/configdb/V1.1.0__accesskey.sql b/scripts/flyway/configdb/V1.1.0__accesskey.sql deleted file mode 100644 index 91ce18f4c19..00000000000 --- a/scripts/flyway/configdb/V1.1.0__accesskey.sql +++ /dev/null @@ -1,36 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -# Dump of table accesskey -# ------------------------------------------------------------ - -Use ApolloConfigDB; - -DROP TABLE IF EXISTS `AccessKey`; - -CREATE TABLE `AccessKey` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', - `Secret` varchar(128) NOT NULL DEFAULT '' COMMENT 'Secret', - `IsEnabled` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: enabled, 0: disabled', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `AppId` (`AppId`(191)), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='访问密钥'; diff --git a/scripts/flyway/configdb/V1.1.1__extend_appId.sql b/scripts/flyway/configdb/V1.1.1__extend_appId.sql deleted file mode 100644 index 07aead33d88..00000000000 --- a/scripts/flyway/configdb/V1.1.1__extend_appId.sql +++ /dev/null @@ -1,24 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -# delta schema to upgrade apollo config db from v1.7.0 to v1.8.0 - -Use ApolloConfigDB; -alter table `AppNamespace` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; -alter table `Cluster` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; -alter table `GrayReleaseRule` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; -alter table `Instance` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; -alter table `InstanceConfig` change ConfigAppId ConfigAppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Config App Id'; -alter table `ReleaseHistory` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; diff --git a/scripts/flyway/configdb/V1.1.2__extend_username.sql b/scripts/flyway/configdb/V1.1.2__extend_username.sql deleted file mode 100644 index 4925a482d8c..00000000000 --- a/scripts/flyway/configdb/V1.1.2__extend_username.sql +++ /dev/null @@ -1,70 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -# delta schema to upgrade apollo config db from v1.7.0 to v1.8.0 - -Use ApolloConfigDB; - -ALTER TABLE `App` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `AppNamespace` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `Audit` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `Cluster` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `Commit` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `GrayReleaseRule` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `Item` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `Namespace` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `NamespaceLock` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `Release` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `ReleaseHistory` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `ServerConfig` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `AccessKey` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; diff --git a/scripts/flyway/configdb/V2.0.0__add-column-deletedat.sql b/scripts/flyway/configdb/V2.0.0__add-column-deletedat.sql deleted file mode 100644 index 55708143923..00000000000 --- a/scripts/flyway/configdb/V2.0.0__add-column-deletedat.sql +++ /dev/null @@ -1,58 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -# delta schema to upgrade apollo config db from v1.9.0 to v2.0.0 - -Use ApolloConfigDB; - -ALTER TABLE `App` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `AppNamespace` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `Audit` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `Cluster` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `Commit` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `GrayReleaseRule` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `Item` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`, - ADD INDEX IX_key (`Key`); - -ALTER TABLE `Namespace` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `NamespaceLock` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `Release` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `ReleaseHistory` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `ServerConfig` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `AccessKey` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; diff --git a/scripts/flyway/configdb/V2.0.1__add-unique-key.sql b/scripts/flyway/configdb/V2.0.1__add-unique-key.sql deleted file mode 100644 index 2d5c9d2a603..00000000000 --- a/scripts/flyway/configdb/V2.0.1__add-unique-key.sql +++ /dev/null @@ -1,76 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -# delta schema to upgrade apollo config db from v1.9.0 to v2.0.0 - -Use ApolloConfigDB; - --- the follow DML won't change the `DataChange_LastTime` field -UPDATE `AccessKey` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `App` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `AppNamespace` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `Audit` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `Cluster` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `Commit` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `GrayReleaseRule` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `Item` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `Namespace` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `NamespaceLock` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `Release` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `ReleaseHistory` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `ServerConfig` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; - --- add UNIQUE CONSTRAINT INDEX for each table -ALTER TABLE `AccessKey` - ADD UNIQUE INDEX `UK_AppId_Secret_DeletedAt` (`AppId`,`Secret`,`DeletedAt`), - DROP INDEX `AppId`; - -ALTER TABLE `App` - ADD UNIQUE INDEX `UK_AppId_DeletedAt` (`AppId`,`DeletedAt`), - DROP INDEX `AppId`; - -ALTER TABLE `AppNamespace` - ADD UNIQUE INDEX `UK_AppId_Name_DeletedAt` (`AppId`,`Name`,`DeletedAt`), - DROP INDEX `IX_AppId`; - --- Ignore TABLE `Audit` - -ALTER TABLE `Cluster` - ADD UNIQUE INDEX `UK_AppId_Name_DeletedAt` (`AppId`,`Name`,`DeletedAt`), - DROP INDEX `IX_AppId_Name`; - --- Ignore TABLE `Commit` - --- Ignore TABLE `GrayReleaseRule`, add unique index in future - --- Ignore TABLE `Item`, add unique index in future - -ALTER TABLE `Namespace` - ADD UNIQUE INDEX `UK_AppId_ClusterName_NamespaceName_DeletedAt` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191),`DeletedAt`), - DROP INDEX `AppId_ClusterName_NamespaceName`; - -ALTER TABLE `NamespaceLock` - ADD UNIQUE INDEX `UK_NamespaceId_DeletedAt` (`NamespaceId`,`DeletedAt`), - DROP INDEX `IX_NamespaceId`; - -ALTER TABLE `Release` - ADD UNIQUE INDEX `UK_ReleaseKey_DeletedAt` (`ReleaseKey`,`DeletedAt`), - DROP INDEX `IX_ReleaseKey`; - --- Ignore TABLE `ReleaseHistory` - -ALTER TABLE `ServerConfig` - ADD UNIQUE INDEX `UK_Key_Cluster_DeletedAt` (`Key`,`Cluster`,`DeletedAt`), - DROP INDEX `IX_Key`; diff --git a/scripts/flyway/flyway-configdb.properties b/scripts/flyway/flyway-configdb.properties deleted file mode 100644 index 1a2f49c774e..00000000000 --- a/scripts/flyway/flyway-configdb.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright 2022 Apollo Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -flyway.user=root -flyway.password=root -flyway.schemas=ApolloConfigDB -flyway.url=jdbc:mysql://localhost:3306?useSSL=false&characterEncoding=utf8 -flyway.locations=filesystem:scripts/flyway/configdb diff --git a/scripts/flyway/flyway-portaldb.properties b/scripts/flyway/flyway-portaldb.properties deleted file mode 100644 index 0e5079b59c5..00000000000 --- a/scripts/flyway/flyway-portaldb.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright 2022 Apollo Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -flyway.user=root -flyway.password=root -flyway.schemas=ApolloPortalDB -flyway.url=jdbc:mysql://localhost:3306?useSSL=false&characterEncoding=utf8 -flyway.locations=filesystem:scripts/flyway/portaldb diff --git a/scripts/flyway/portaldb/V1.0.0__initialization.sql b/scripts/flyway/portaldb/V1.0.0__initialization.sql deleted file mode 100644 index 517c1275fda..00000000000 --- a/scripts/flyway/portaldb/V1.0.0__initialization.sql +++ /dev/null @@ -1,345 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - -# Create Database -# ------------------------------------------------------------ -CREATE DATABASE IF NOT EXISTS ApolloPortalDB DEFAULT CHARACTER SET = utf8mb4; - -Use ApolloPortalDB; - -# Dump of table app -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `App`; - -CREATE TABLE `App` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', - `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', - `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名', - `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id', - `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字', - `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName', - `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `AppId` (`AppId`(191)), - KEY `DataChange_LastTime` (`DataChange_LastTime`), - KEY `IX_Name` (`Name`(191)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用表'; - - - -# Dump of table appnamespace -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `AppNamespace`; - -CREATE TABLE `AppNamespace` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `Name` varchar(32) NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一', - `AppId` varchar(32) NOT NULL DEFAULT '' COMMENT 'app id', - `Format` varchar(32) NOT NULL DEFAULT 'properties' COMMENT 'namespace的format类型', - `IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace是否为公共', - `Comment` varchar(64) NOT NULL DEFAULT '' COMMENT '注释', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_AppId` (`AppId`), - KEY `Name_AppId` (`Name`,`AppId`), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义'; - - - -# Dump of table consumer -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Consumer`; - -CREATE TABLE `Consumer` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', - `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名', - `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id', - `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字', - `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName', - `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `AppId` (`AppId`(191)), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='开放API消费者'; - - - -# Dump of table consumeraudit -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `ConsumerAudit`; - -CREATE TABLE `ConsumerAudit` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id', - `Uri` varchar(1024) NOT NULL DEFAULT '' COMMENT '访问的Uri', - `Method` varchar(16) NOT NULL DEFAULT '' COMMENT '访问的Method', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), - KEY `IX_ConsumerId` (`ConsumerId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer审计表'; - - - -# Dump of table consumerrole -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `ConsumerRole`; - -CREATE TABLE `ConsumerRole` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id', - `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) DEFAULT '' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), - KEY `IX_RoleId` (`RoleId`), - KEY `IX_ConsumerId_RoleId` (`ConsumerId`,`RoleId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer和role的绑定表'; - - - -# Dump of table consumertoken -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `ConsumerToken`; - -CREATE TABLE `ConsumerToken` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'ConsumerId', - `Token` varchar(128) NOT NULL DEFAULT '' COMMENT 'token', - `Expires` datetime NOT NULL DEFAULT '2099-01-01 00:00:00' COMMENT 'token失效时间', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - UNIQUE KEY `IX_Token` (`Token`), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer token表'; - -# Dump of table favorite -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Favorite`; - -CREATE TABLE `Favorite` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', - `UserId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '收藏的用户', - `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', - `Position` int(32) NOT NULL DEFAULT '10000' COMMENT '收藏顺序', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `AppId` (`AppId`(191)), - KEY `IX_UserId` (`UserId`), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COMMENT='应用收藏表'; - -# Dump of table permission -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Permission`; - -CREATE TABLE `Permission` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `PermissionType` varchar(32) NOT NULL DEFAULT '' COMMENT '权限类型', - `TargetId` varchar(256) NOT NULL DEFAULT '' COMMENT '权限对象类型', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_TargetId_PermissionType` (`TargetId`(191),`PermissionType`), - KEY `IX_DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='permission表'; - - - -# Dump of table role -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Role`; - -CREATE TABLE `Role` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `RoleName` varchar(256) NOT NULL DEFAULT '' COMMENT 'Role name', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_RoleName` (`RoleName`(191)), - KEY `IX_DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表'; - - - -# Dump of table rolepermission -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `RolePermission`; - -CREATE TABLE `RolePermission` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id', - `PermissionId` int(10) unsigned DEFAULT NULL COMMENT 'Permission Id', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) DEFAULT '' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), - KEY `IX_RoleId` (`RoleId`), - KEY `IX_PermissionId` (`PermissionId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色和权限的绑定表'; - - - -# Dump of table serverconfig -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `ServerConfig`; - -CREATE TABLE `ServerConfig` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key', - `Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值', - `Comment` varchar(1024) DEFAULT '' COMMENT '注释', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_Key` (`Key`), - KEY `DataChange_LastTime` (`DataChange_LastTime`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置'; - - - -# Dump of table userrole -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `UserRole`; - -CREATE TABLE `UserRole` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `UserId` varchar(128) DEFAULT '' COMMENT '用户身份标识', - `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id', - `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', - `DataChange_CreatedBy` varchar(32) DEFAULT '' COMMENT '创建人邮箱前缀', - `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', - `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', - PRIMARY KEY (`Id`), - KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), - KEY `IX_RoleId` (`RoleId`), - KEY `IX_UserId_RoleId` (`UserId`,`RoleId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和role的绑定表'; - -# Dump of table Users -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Users`; - -CREATE TABLE `Users` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `Username` varchar(64) NOT NULL DEFAULT 'default' COMMENT '用户名', - `Password` varchar(64) NOT NULL DEFAULT 'default' COMMENT '密码', - `Email` varchar(64) NOT NULL DEFAULT 'default' COMMENT '邮箱地址', - `Enabled` tinyint(4) DEFAULT NULL COMMENT '是否有效', - PRIMARY KEY (`Id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表'; - - -# Dump of table Authorities -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Authorities`; - -CREATE TABLE `Authorities` ( - `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', - `Username` varchar(64) NOT NULL, - `Authority` varchar(50) NOT NULL, - PRIMARY KEY (`Id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - - -# Config -# ------------------------------------------------------------ -INSERT INTO `ServerConfig` (`Key`, `Value`, `Comment`) -VALUES - ('apollo.portal.envs', 'dev', '可支持的环境列表'), - ('organizations', '[{\"orgId\":\"TEST1\",\"orgName\":\"样例部门1\"},{\"orgId\":\"TEST2\",\"orgName\":\"样例部门2\"}]', '部门列表'), - ('superAdmin', 'apollo', 'Portal超级管理员'), - ('api.readTimeout', '10000', 'http接口read timeout'), - ('consumer.token.salt', 'someSalt', 'consumer token salt'), - ('admin.createPrivateNamespace.switch', 'true', '是否允许项目管理员创建私有namespace'), - ('configView.memberOnly.envs', 'pro', '只对项目成员显示配置信息的环境列表,多个env以英文逗号分隔'); - - -INSERT INTO `Users` (`Username`, `Password`, `Email`, `Enabled`) -VALUES - ('apollo', '$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS', 'apollo@acme.com', 1); - -INSERT INTO `Authorities` (`Username`, `Authority`) VALUES ('apollo', 'ROLE_user'); - -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/scripts/flyway/portaldb/V1.1.1__extend_appId.sql b/scripts/flyway/portaldb/V1.1.1__extend_appId.sql deleted file mode 100644 index e32f107420b..00000000000 --- a/scripts/flyway/portaldb/V1.1.1__extend_appId.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -# delta schema to upgrade apollo portal db from v1.7.0 to v1.8.0 - -Use ApolloPortalDB; - -alter table `AppNamespace` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; diff --git a/scripts/flyway/portaldb/V1.1.2__extend_username.sql b/scripts/flyway/portaldb/V1.1.2__extend_username.sql deleted file mode 100644 index d52b578f442..00000000000 --- a/scripts/flyway/portaldb/V1.1.2__extend_username.sql +++ /dev/null @@ -1,62 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -# delta schema to upgrade apollo config db from v1.7.0 to v1.8.0 - -Use ApolloPortalDB; - -ALTER TABLE `App` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `AppNamespace` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `Consumer` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `ConsumerRole` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `ConsumerToken` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `Favorite` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `Permission` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `Role` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `RolePermission` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `ServerConfig` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; - -ALTER TABLE `UserRole` - MODIFY COLUMN `DataChange_CreatedBy` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', - MODIFY COLUMN `DataChange_LastModifiedBy` VARCHAR(64) DEFAULT '' COMMENT '最后修改人邮箱前缀'; diff --git a/scripts/flyway/portaldb/V1.1.3__add_preferred_username.sql b/scripts/flyway/portaldb/V1.1.3__add_preferred_username.sql deleted file mode 100644 index 13f93c8d97f..00000000000 --- a/scripts/flyway/portaldb/V1.1.3__add_preferred_username.sql +++ /dev/null @@ -1,21 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -Use ApolloPortalDB; - -ALTER TABLE `Users` - MODIFY COLUMN `Username` varchar(64) NOT NULL DEFAULT 'default' COMMENT '用户登录账户', - ADD COLUMN `UserDisplayName` varchar(512) NOT NULL DEFAULT 'default' COMMENT '用户名称' AFTER `Password`; -UPDATE `Users` SET `UserDisplayName`=`Username` WHERE `UserDisplayName` = 'default'; diff --git a/scripts/flyway/portaldb/V1.1.4__delegating-password-encoder.sql b/scripts/flyway/portaldb/V1.1.4__delegating-password-encoder.sql deleted file mode 100644 index e8451671600..00000000000 --- a/scripts/flyway/portaldb/V1.1.4__delegating-password-encoder.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -Use ApolloPortalDB; - -ALTER TABLE `Users` - MODIFY COLUMN `Password` varchar(512) NOT NULL DEFAULT 'default' COMMENT '密码'; -UPDATE `Users` SET `Password` = REPLACE(`Password`, '{nonsensical}', '{placeholder}') WHERE `Password` LIKE '{nonsensical}%'; diff --git a/scripts/flyway/portaldb/V1.1.5__jdbc-session.sql b/scripts/flyway/portaldb/V1.1.5__jdbc-session.sql deleted file mode 100644 index 938a19b699b..00000000000 --- a/scripts/flyway/portaldb/V1.1.5__jdbc-session.sql +++ /dev/null @@ -1,40 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -Use ApolloPortalDB; - --- spring session (https://github.com/spring-projects/spring-session/blob/faee8f1bdb8822a5653a81eba838dddf224d92d6/spring-session-jdbc/src/main/resources/org/springframework/session/jdbc/schema-mysql.sql) -CREATE TABLE SPRING_SESSION ( - PRIMARY_ID CHAR(36) NOT NULL, - SESSION_ID CHAR(36) NOT NULL, - CREATION_TIME BIGINT NOT NULL, - LAST_ACCESS_TIME BIGINT NOT NULL, - MAX_INACTIVE_INTERVAL INT NOT NULL, - EXPIRY_TIME BIGINT NOT NULL, - PRINCIPAL_NAME VARCHAR(100), - CONSTRAINT SPRING_SESSION_PK PRIMARY KEY (PRIMARY_ID) -) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; - -CREATE UNIQUE INDEX SPRING_SESSION_IX1 ON SPRING_SESSION (SESSION_ID); -CREATE INDEX SPRING_SESSION_IX2 ON SPRING_SESSION (EXPIRY_TIME); -CREATE INDEX SPRING_SESSION_IX3 ON SPRING_SESSION (PRINCIPAL_NAME); - -CREATE TABLE SPRING_SESSION_ATTRIBUTES ( - SESSION_PRIMARY_ID CHAR(36) NOT NULL, - ATTRIBUTE_NAME VARCHAR(200) NOT NULL, - ATTRIBUTE_BYTES BLOB NOT NULL, - CONSTRAINT SPRING_SESSION_ATTRIBUTES_PK PRIMARY KEY (SESSION_PRIMARY_ID, ATTRIBUTE_NAME), - CONSTRAINT SPRING_SESSION_ATTRIBUTES_FK FOREIGN KEY (SESSION_PRIMARY_ID) REFERENCES SPRING_SESSION(PRIMARY_ID) ON DELETE CASCADE -) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; diff --git a/scripts/flyway/portaldb/V2.0.0__add-column-deletedat.sql b/scripts/flyway/portaldb/V2.0.0__add-column-deletedat.sql deleted file mode 100644 index 726270f6fe5..00000000000 --- a/scripts/flyway/portaldb/V2.0.0__add-column-deletedat.sql +++ /dev/null @@ -1,51 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -# delta schema to upgrade apollo portal db from v1.9.0 to v2.0.0 - -Use ApolloPortalDB; - -ALTER TABLE `App` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `AppNamespace` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `Consumer` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `ConsumerRole` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `ConsumerToken` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `Favorite` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `Permission` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `Role` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `RolePermission` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `ServerConfig` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; - -ALTER TABLE `UserRole` - ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`; \ No newline at end of file diff --git a/scripts/flyway/portaldb/V2.0.1__add-unique-key.sql b/scripts/flyway/portaldb/V2.0.1__add-unique-key.sql deleted file mode 100644 index 444d6df762f..00000000000 --- a/scripts/flyway/portaldb/V2.0.1__add-unique-key.sql +++ /dev/null @@ -1,79 +0,0 @@ --- --- Copyright 2022 Apollo Authors --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -# delta schema to upgrade apollo portal db from v1.9.0 to v2.0.0 - -Use ApolloPortalDB; - --- the follow DML won't change the `DataChange_LastTime` field -UPDATE `App` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `AppNamespace` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `Consumer` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `ConsumerRole` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `ConsumerToken` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `Favorite` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `Permission` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `Role` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `RolePermission` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `ServerConfig` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; -UPDATE `UserRole` SET `DeletedAt` = -Id, `DataChange_LastTime` = `DataChange_LastTime` WHERE `IsDeleted` = 1 and `DeletedAt` = 0; - --- add UNIQUE CONSTRAINT INDEX for each table -ALTER TABLE `App` - ADD UNIQUE INDEX `UK_AppId_DeletedAt` (`AppId`,`DeletedAt`), - DROP INDEX `AppId`; - -ALTER TABLE `AppNamespace` - ADD UNIQUE INDEX `UK_AppId_Name_DeletedAt` (`AppId`,`Name`,`DeletedAt`), - DROP INDEX `IX_AppId`; - -ALTER TABLE `Consumer` - ADD UNIQUE INDEX `UK_AppId_DeletedAt` (`AppId`,`DeletedAt`), - DROP INDEX `AppId`; - -ALTER TABLE `ConsumerRole` - ADD UNIQUE INDEX `UK_ConsumerId_RoleId_DeletedAt` (`ConsumerId`,`RoleId`,`DeletedAt`), - DROP INDEX `IX_ConsumerId_RoleId`; - -ALTER TABLE `ConsumerToken` - ADD UNIQUE INDEX `UK_Token_DeletedAt` (`Token`,`DeletedAt`), - DROP INDEX `IX_Token`; - -ALTER TABLE `Favorite` - ADD UNIQUE INDEX `UK_UserId_AppId_DeletedAt` (`UserId`,`AppId`,`DeletedAt`), - DROP INDEX `IX_UserId`; - -ALTER TABLE `Permission` - ADD UNIQUE INDEX `UK_TargetId_PermissionType_DeletedAt` (`TargetId`,`PermissionType`,`DeletedAt`), - DROP INDEX `IX_TargetId_PermissionType`; - -ALTER TABLE `Role` - ADD UNIQUE INDEX `UK_RoleName_DeletedAt` (`RoleName`,`DeletedAt`), - DROP INDEX `IX_RoleName`; - -ALTER TABLE `RolePermission` - ADD UNIQUE INDEX `UK_RoleId_PermissionId_DeletedAt` (`RoleId`,`PermissionId`,`DeletedAt`), - DROP INDEX `IX_RoleId`; - -ALTER TABLE `ServerConfig` - ADD UNIQUE INDEX `UK_Key_DeletedAt` (`Key`,`DeletedAt`), - DROP INDEX `IX_Key`; - -ALTER TABLE `UserRole` - ADD UNIQUE INDEX `UK_UserId_RoleId_DeletedAt` (`UserId`,`RoleId`,`DeletedAt`), - DROP INDEX `IX_UserId_RoleId`; - -ALTER TABLE `Users` - ADD UNIQUE INDEX `UK_Username` (`Username`); From b657806a5dd332d846ba0b3396b00fd1894625e5 Mon Sep 17 00:00:00 2001 From: nisiyong Date: Sun, 26 Jun 2022 23:14:03 +0800 Subject: [PATCH 2/2] docs: update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 2aa3e7ffdbd..bb54a95aa8a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,5 +11,6 @@ Apollo 2.1.0 * [refactor Functions class with lambda](https://github.com/apolloconfig/apollo/pull/4419) * [fix:occur a 400 error request when openapi key's parameter contain "a[0]"](https://github.com/apolloconfig/apollo/pull/4424) * [Upgrade mysql-connector-java version to fix possible transaction rollback failure issue](https://github.com/apolloconfig/apollo/pull/4425) +* [Remove database migration tool Flyway](https://github.com/apolloconfig/apollo/pull/4361) ------------------ All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/11?closed=1)