This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-paimon-webui.git
The following commit(s) were added to refs/heads/main by this push:
new 5b46f36 [Feature][web] add h2 (#15)
5b46f36 is described below
commit 5b46f3609d14d67114249e1d622052d706468890
Author: ZackYoung <[email protected]>
AuthorDate: Fri Jul 28 12:13:34 2023 +0800
[Feature][web] add h2 (#15)
---
paimon-web-server/pom.xml | 8 +++-
.../src/main/resources/application-dev.yml | 15 +++++--
paimon-web-server/src/main/resources/db/ddl-h2.sql | 50 ++++++++++++++++++++++
paimon-web-server/src/main/resources/db/dml-h2.sql | 25 +++++++++++
4 files changed, 93 insertions(+), 5 deletions(-)
diff --git a/paimon-web-server/pom.xml b/paimon-web-server/pom.xml
index bbbac21..ea8aeb2 100644
--- a/paimon-web-server/pom.xml
+++ b/paimon-web-server/pom.xml
@@ -119,6 +119,12 @@ under the License.
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
+ <!-- h2 -->
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
<build>
@@ -216,7 +222,6 @@ under the License.
<excludes>
<exclude>/application*.yml</exclude>
<exclude>/mybatis*.xml</exclude>
- <exclude>/DinkyFlinkDockerfile</exclude>
</excludes>
</configuration>
<executions>
@@ -233,3 +238,4 @@ under the License.
</build>
</project>
+
diff --git a/paimon-web-server/src/main/resources/application-dev.yml
b/paimon-web-server/src/main/resources/application-dev.yml
index 090a98f..4006d8a 100644
--- a/paimon-web-server/src/main/resources/application-dev.yml
+++ b/paimon-web-server/src/main/resources/application-dev.yml
@@ -15,7 +15,14 @@
spring:
datasource:
- url:
jdbc:mysql://${MYSQL_ADDR:localhost:3306}/${MYSQL_DATABASE:paimon}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
- username: ${MYSQL_USERNAME:root}
- password: ${MYSQL_PASSWORD:root}
- driver-class-name: com.mysql.cj.jdbc.Driver
\ No newline at end of file
+ driver-class-name: org.h2.Driver
+ url:
jdbc:h2:mem:paimon;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=true;INIT=runscript
from 'classpath:db/ddl-h2.sql'
+ username: root
+ password: root
+ sql:
+ init:
+ data-locations: classpath:db/dml-h2.sql
+ continue-on-error: true
+ username: root
+ password: root
+ mode: always
\ No newline at end of file
diff --git a/paimon-web-server/src/main/resources/db/ddl-h2.sql
b/paimon-web-server/src/main/resources/db/ddl-h2.sql
new file mode 100644
index 0000000..5dc28cd
--- /dev/null
+++ b/paimon-web-server/src/main/resources/db/ddl-h2.sql
@@ -0,0 +1,50 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You 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.
+
+CREATE TABLE if not exists `user`
+(
+ `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT COMMENT
'ID',
+ `username` varchar(50) NOT NULL COMMENT 'username',
+ `password` varchar(50) NULL DEFAULT NULL COMMENT 'password',
+ `nickname` varchar(50) NULL DEFAULT NULL COMMENT 'nickname',
+ `user_type` int NOT NULL DEFAULT 0 COMMENT 'login type
(0:LOCAL,1:LDAP)',
+ `url` varchar(100) NULL DEFAULT NULL COMMENT 'avatar url',
+ `mobile` varchar(20) NULL DEFAULT NULL COMMENT 'mobile phone',
+ `email` varchar(100) NULL DEFAULT NULL COMMENT 'email',
+ `enabled` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'is enable',
+ `is_delete` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is delete',
+ `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT
'create time',
+ `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT
'update time'
+) ENGINE = InnoDB;
+
+CREATE TABLE if not exists `tenant`
+(
+ `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT COMMENT
'ID',
+ `name` varchar(64) NULL DEFAULT NULL COMMENT 'tenant name',
+ `description` varchar(255) NULL DEFAULT NULL COMMENT 'tenant
description',
+ `is_delete` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is delete',
+ `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT
'create time',
+ `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT
'update time'
+) ENGINE = InnoDB;
+
+CREATE TABLE if not exists `user_tenant`
+(
+ `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT COMMENT 'ID',
+ `user_id` int(11) NOT NULL COMMENT 'user id',
+ `tenant_id` int(11) NOT NULL COMMENT 'tenant id',
+ `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create
time',
+ `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'update
time'
+) ENGINE = InnoDB;
+
diff --git a/paimon-web-server/src/main/resources/db/dml-h2.sql
b/paimon-web-server/src/main/resources/db/dml-h2.sql
new file mode 100644
index 0000000..a8cb3e3
--- /dev/null
+++ b/paimon-web-server/src/main/resources/db/dml-h2.sql
@@ -0,0 +1,25 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You 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.
+
+INSERT INTO `user` ( id, username, password, nickname, mobile
+ , email, enabled, is_delete)
+VALUES ( 1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Admin', 0
+ , '[email protected]', 1, 0);
+
+INSERT INTO `tenant` (id, name, description)
+VALUES (1, 'DefaultTenant', 'DefaultTenant');
+
+INSERT INTO `user_tenant` (`id`, `user_id`, `tenant_id`)
+VALUES (1, 1, 1);
\ No newline at end of file