Skip to content

Commit

Permalink
Bump h2 version to 2.x, consistent with springboot
Browse files Browse the repository at this point in the history
  • Loading branch information
shoothzj authored and nobodyiam committed Feb 28, 2023
1 parent 2dcbc1d commit 78099b4
Show file tree
Hide file tree
Showing 22 changed files with 163 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spring.cloud.consul.enabled=false
spring.cloud.zookeeper.enabled=false
spring.cloud.discovery.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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ INSERT INTO AppNamespace (AppId, Name) VALUES ('someAppId', 'application');

INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (100, 'someAppId', 'default', 'application');

INSERT INTO Item (NamespaceId, `Key`, `Type`, Value, Comment) VALUES (100, 'k1', '0', 'v1', 'comment1');
INSERT INTO Item (NamespaceId, `Key`, `Type`, Value, Comment) VALUES (100, 'k2', '0', 'v2', 'comment1');
INSERT INTO Item (NamespaceId, `Key`, `Type`, Value, Comment) VALUES (100, 'k3', '0', 'v3', 'comment1');
INSERT INTO Item (NamespaceId, "Key", "Type", "Value", Comment) VALUES (100, 'k1', '0', 'v1', 'comment1');
INSERT INTO Item (NamespaceId, "Key", "Type", "Value", Comment) VALUES (100, 'k2', '0', 'v2', 'comment1');
INSERT INTO Item (NamespaceId, "Key", "Type", "Value", Comment) VALUES (100, 'k3', '0', 'v3', 'comment1');
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`)
INSERT INTO `ServerConfig` ("Key", "Cluster", "Value")
VALUES
('name', 'default', 'kl');
9 changes: 4 additions & 5 deletions apollo-adminservice/src/test/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (2, 'fxherm
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (3, '100003172', 'default', 'application');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (4, '100003173', 'default', 'application');

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);
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);

INSERT INTO RELEASE (ReleaseKey, Name, Comment, AppId, ClusterName, NamespaceName, Configurations) VALUES ('TEST-RELEASE-KEY', 'REV1','First Release','100003171', 'default', 'application', '{"k1":"v1"}');

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`)
INSERT INTO `ServerConfig` ("Key", "Cluster", "Value")
VALUES
('admin-service.access.tokens', 'default', 'someToken,anotherToken'),
('admin-service.access.control.enabled', 'default', 'false');
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`)
INSERT INTO `ServerConfig` ("Key", "Cluster", "Value")
VALUES
('admin-service.access.control.enabled', 'default', 'true');
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`)
INSERT INTO `ServerConfig` ("Key", "Cluster", "Value")
VALUES
('admin-service.access.tokens', 'default', 'someToken,anotherToken'),
('admin-service.access.control.enabled', 'default', 'true');
23 changes: 22 additions & 1 deletion apollo-adminservice/src/test/resources/import.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,25 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
CREATE ALIAS IF NOT EXISTS UNIX_TIMESTAMP FOR "com.ctrip.framework.apollo.common.jpa.H2Function.unixTimestamp";
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 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 RELEASE ALTER COLUMN DataChange_CreatedBy VARCHAR(255) NULL;
ALTER TABLE RELEASE ALTER COLUMN DataChange_CreatedTime TIMESTAMP 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;
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 @@ -35,13 +35,13 @@ public class Item extends BaseEntity {
@Column(name = "NamespaceId", nullable = false)
private long namespaceId;

@Column(name = "key", nullable = false)
@Column(name = "`Key`", nullable = false)
private String key;

@Column(name = "type")
@Column(name = "`Type`")
private int type;

@Column(name = "value")
@Column(name = "`Value`")
@Lob
private String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
@SQLDelete(sql = "Update ServerConfig set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?")
@Where(clause = "isDeleted = 0")
public class ServerConfig extends BaseEntity {
@Column(name = "Key", nullable = false)
@Column(name = "`Key`", nullable = false)
private String key;

@Column(name = "Cluster", nullable = false)
@Column(name = "`Cluster`", nullable = false)
private String cluster;

@Column(name = "Value", nullable = false)
@Column(name = "`Value`", nullable = false)
private String value;

@Column(name = "Comment", nullable = false)
Expand Down
2 changes: 1 addition & 1 deletion apollo-biz/src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spring.cloud.consul.enabled=false
spring.cloud.zookeeper.enabled=false
spring.cloud.discovery.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
41 changes: 40 additions & 1 deletion 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.
--
CREATE ALIAS IF NOT EXISTS UNIX_TIMESTAMP FOR "com.ctrip.framework.apollo.common.jpa.H2Function.unixTimestamp";
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";
2 changes: 1 addition & 1 deletion apollo-biz/src/test/resources/sql/item-test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
INSERT INTO `item` (`Id`, `NamespaceId`, `Key`, `Type`, `Value`, `Comment`, `LineNum`)
INSERT INTO Item (`Id`, `NamespaceId`, "Key", "Type", "Value", `Comment`, `LineNum`)
VALUES
(9901, 1, 'k1', 0, 'v1', '', 1),
(9902, 2, 'k2', 2, 'v2', '', 2);
Expand Down
2 changes: 1 addition & 1 deletion apollo-biz/src/test/resources/sql/namespace-test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ INSERT INTO `namespace` (`AppId`, `ClusterName`, `NamespaceName`, `IsDeleted`, `
INSERT INTO `commit` (`ChangeSets`, `AppId`, `ClusterName`, `NamespaceName`)VALUES('{}', 'testApp', 'default', 'application');
INSERT INTO `commit` (`ChangeSets`, `AppId`, `ClusterName`, `NamespaceName`, `DataChange_LastTime`)VALUES('{}', 'commitTestApp', 'default', 'application', '2020-08-22 10:00:00');

INSERT INTO `item` (`NamespaceId`, `Key`, `Value`, `Comment`, `LineNum`)VALUES(1, 'k1', 'v1', '', 1);
INSERT INTO `item` (`NamespaceId`, "Key", "Value", `Comment`, `LineNum`)VALUES(1, 'k1', 'v1', '', 1);

INSERT INTO `namespacelock` (`NamespaceId`)VALUES(1);

Expand Down
Loading

0 comments on commit 78099b4

Please sign in to comment.