Skip to content

Commit

Permalink
put all temp alter to import.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangJian He committed Feb 28, 2023
1 parent e464e7a commit 3bb862a
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 67 deletions.
40 changes: 0 additions & 40 deletions apollo-biz/src/test/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,6 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
ALTER TABLE APP ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE APP ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE APP ALTER COLUMN ORGNAME VARCHAR(255) NULL;
ALTER TABLE APP ALTER COLUMN ORGID VARCHAR(255) NULL;
ALTER TABLE AppNamespace ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE AppNamespace ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE AppNamespace ALTER COLUMN Format VARCHAR(255) NULL;
ALTER TABLE AccessKey ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE AccessKey ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Instance ALTER COLUMN CLUSTERNAME VARCHAR(255) NULL;
ALTER TABLE Instance ALTER COLUMN DATACENTER VARCHAR(255) NULL;
ALTER TABLE Instance ALTER COLUMN IP VARCHAR(255) NULL;
ALTER TABLE InstanceConfig ALTER COLUMN RELEASEDELIVERYTIME VARCHAR(255) NULL;
ALTER TABLE InstanceConfig ALTER COLUMN RELEASEKEY VARCHAR(255) NULL;
ALTER TABLE ServerConfig ALTER COLUMN DATACHANGE_CREATEDBY VARCHAR(255) NULL;
ALTER TABLE ServerConfig ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE ServerConfig ALTER COLUMN COMMENT VARCHAR(255) NULL;
ALTER TABLE Audit ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Audit ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Cluster ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Cluster ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Cluster ALTER COLUMN ParentClusterId BIGINT DEFAULT 0;
ALTER TABLE Namespace ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Namespace ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Item ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Item ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE GrayReleaseRule ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE GrayReleaseRule ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Release ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Release ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Release ALTER COLUMN Comment VARCHAR(255) NULL;
ALTER TABLE Release ALTER COLUMN Name VARCHAR(255) NULL;
ALTER TABLE Release ALTER COLUMN ReleaseKey VARCHAR(255) NULL;
ALTER TABLE ReleaseHistory ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE ReleaseHistory ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Commit ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Commit ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE NamespaceLock ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE NamespaceLock ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;

INSERT INTO AppNamespace (AppId, Name, IsPublic) VALUES ('100003171', 'application', false);
INSERT INTO AppNamespace (AppId, Name, IsPublic) VALUES ('100003171', 'fx.apollo.config', true);
INSERT INTO AppNamespace (AppId, Name, IsPublic) VALUES ('100003172', 'application', false);
Expand Down
39 changes: 39 additions & 0 deletions apollo-biz/src/test/resources/import.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,43 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
ALTER TABLE APP ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE APP ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE APP ALTER COLUMN ORGNAME VARCHAR(255) NULL;
ALTER TABLE APP ALTER COLUMN ORGID VARCHAR(255) NULL;
ALTER TABLE AppNamespace ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE AppNamespace ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE AppNamespace ALTER COLUMN Format VARCHAR(255) NULL;
ALTER TABLE AccessKey ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE AccessKey ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Instance ALTER COLUMN CLUSTERNAME VARCHAR(255) NULL;
ALTER TABLE Instance ALTER COLUMN DATACENTER VARCHAR(255) NULL;
ALTER TABLE Instance ALTER COLUMN IP VARCHAR(255) NULL;
ALTER TABLE InstanceConfig ALTER COLUMN RELEASEDELIVERYTIME VARCHAR(255) NULL;
ALTER TABLE InstanceConfig ALTER COLUMN RELEASEKEY VARCHAR(255) NULL;
ALTER TABLE ServerConfig ALTER COLUMN DATACHANGE_CREATEDBY VARCHAR(255) NULL;
ALTER TABLE ServerConfig ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE ServerConfig ALTER COLUMN COMMENT VARCHAR(255) NULL;
ALTER TABLE Audit ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Audit ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Cluster ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Cluster ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Cluster ALTER COLUMN ParentClusterId BIGINT DEFAULT 0;
ALTER TABLE Namespace ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Namespace ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Item ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Item ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE GrayReleaseRule ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE GrayReleaseRule ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Release ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Release ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Release ALTER COLUMN Comment VARCHAR(255) NULL;
ALTER TABLE Release ALTER COLUMN Name VARCHAR(255) NULL;
ALTER TABLE Release ALTER COLUMN ReleaseKey VARCHAR(255) NULL;
ALTER TABLE ReleaseHistory ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE ReleaseHistory ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Commit ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Commit ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE NamespaceLock ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE NamespaceLock ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
CREATE ALIAS IF NOT EXISTS UNIX_TIMESTAMP FOR "com.ctrip.framework.apollo.common.jpa.H2Function.unixTimestamp";
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
spring.cloud.consul.enabled=false
spring.cloud.zookeeper.enabled=false

spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1
spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1;BUILTIN_ALIAS_OVERRIDE=TRUE

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.globally_quoted_identifiers=false
Expand Down
12 changes: 0 additions & 12 deletions apollo-configservice/src/test/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ INSERT INTO App (AppId, Name, OwnerName, OwnerEmail) VALUES ('100003172','apollo
INSERT INTO App (AppId, Name, OwnerName, OwnerEmail) VALUES ('100003173','apollo-portal','张乐','[email protected]');
INSERT INTO App (AppId, Name, OwnerName, OwnerEmail) VALUES ('fxhermesproducer','fx-hermes-producer','梁锦华','[email protected]');

ALTER TABLE Cluster ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Cluster ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Cluster ALTER COLUMN ParentClusterId BIGINT NULL;
INSERT INTO Cluster (AppId, Name) VALUES ('100003171', 'default');
INSERT INTO Cluster (AppId, Name) VALUES ('100003171', 'cluster1');
INSERT INTO Cluster (AppId, Name) VALUES ('100003172', 'default');
Expand All @@ -29,9 +26,6 @@ INSERT INTO Cluster (AppId, Name) VALUES ('100003173', 'default');
INSERT INTO Cluster (AppId, Name) VALUES ('100003173', 'cluster3');
INSERT INTO Cluster (AppId, Name) VALUES ('fxhermesproducer', 'default');

ALTER TABLE AppNamespace ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE AppNamespace ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE AppNamespace ALTER COLUMN Format VARCHAR(255) NULL;
INSERT INTO AppNamespace (AppId, Name) VALUES ('100003171', 'application');
INSERT INTO AppNamespace (AppId, Name) VALUES ('100003171', 'fx.apollo.config');
INSERT INTO AppNamespace (AppId, Name) VALUES ('100003172', 'application');
Expand All @@ -40,21 +34,15 @@ INSERT INTO AppNamespace (AppId, Name) VALUES ('100003173', 'application');
INSERT INTO AppNamespace (AppId, Name) VALUES ('100003173', 'fx.apollo.portal');
INSERT INTO AppNamespace (AppID, Name) VALUES ('fxhermesproducer', 'fx.hermes.producer');

ALTER TABLE Namespace ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Namespace ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (1, '100003171', 'default', 'application');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (5, '100003171', 'cluster1', 'application');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (2, 'fxhermesproducer', 'default', 'fx.hermes.producer');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (3, '100003172', 'default', 'application');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (4, '100003173', 'default', 'application');

ALTER TABLE Item ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Item ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
INSERT INTO Item (NamespaceId, "Key", "Value", Comment) VALUES (1, 'k1', 'v1', 'comment1');
INSERT INTO Item (NamespaceId, "Key", "Value", Comment) VALUES (1, 'k2', 'v2', 'comment2');
INSERT INTO Item (NamespaceId, "Key", "Value", Comment) VALUES (2, 'k3', 'v3', 'comment3');
INSERT INTO Item (NamespaceId, "Key", "Value", Comment, LineNum) VALUES (5, 'k1', 'v4', 'comment4',1);

ALTER TABLE RELEASE ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE RELEASE ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
INSERT INTO RELEASE (ReleaseKey, Name, Comment, AppId, ClusterName, NamespaceName, Configurations) VALUES ('TEST-RELEASE-KEY', 'REV1','First Release','100003171', 'default', 'application', '{"k1":"v1"}');
13 changes: 9 additions & 4 deletions apollo-configservice/src/test/resources/import.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ ALTER TABLE Audit ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Audit ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE GrayReleaseRule ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE GrayReleaseRule ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE APP ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE APP ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE APP ALTER COLUMN ORGNAME VARCHAR(255) NULL;
ALTER TABLE APP ALTER COLUMN ORGID VARCHAR(255) NULL;
ALTER TABLE RELEASE ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE RELEASE ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Item ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Item ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE Namespace ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Namespace ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE AppNamespace ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE AppNamespace ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
ALTER TABLE AppNamespace ALTER COLUMN Format VARCHAR(255) NULL;
CREATE ALIAS IF NOT EXISTS UNIX_TIMESTAMP FOR "com.ctrip.framework.apollo.common.jpa.H2Function.unixTimestamp";
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
ALTER TABLE ConsumerRole ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE ConsumerRole ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
INSERT INTO `consumerrole` (`Id`, `ConsumerId`, `RoleId`, `DataChange_CreatedBy`, `DataChange_LastModifiedBy`)
VALUES (890, 1, 990, 'someOperator', 'someOperator');
INSERT INTO `consumerrole` (`Id`, `ConsumerId`, `RoleId`, `DataChange_CreatedBy`, `DataChange_LastModifiedBy`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
ALTER TABLE Permission ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Permission ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
INSERT INTO `permission` (`Id`, `PermissionType`, `TargetId`) VALUES (990, 'somePermissionType', 'someTargetId');
INSERT INTO `permission` (`Id`, `PermissionType`, `TargetId`) VALUES (991, 'anotherPermissionType', 'anotherTargetId');
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
ALTER TABLE RolePermission ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE RolePermission ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
INSERT INTO `rolepermission` (`Id`, `RoleId`, `PermissionId`) VALUES (990, 990, 990);
INSERT INTO `rolepermission` (`Id`, `RoleId`, `PermissionId`) VALUES (991, 990, 991);
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
ALTER TABLE Role ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE Role ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
INSERT INTO `role` (`Id`, `RoleName`) VALUES (990, 'someRoleName');
INSERT INTO `role` (`Id`, `RoleName`) VALUES (991, 'anotherRoleName');
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
ALTER TABLE UserRole ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE UserRole ALTER COLUMN DataChange_CreatedTime TIMESTAMP NULL;
INSERT INTO `userrole` (`Id`, `UserId`, `RoleId`, `DataChange_CreatedBy`, `DataChange_LastModifiedBy`)
VALUES (990, 'someUser', 990, 'someOperator', 'someOperator');
INSERT INTO `userrole` (`Id`, `UserId`, `RoleId`, `DataChange_CreatedBy`, `DataChange_LastModifiedBy`)
Expand Down

0 comments on commit 3bb862a

Please sign in to comment.