add h2 and save user info to db

This commit is contained in:
许晓东
2021-09-06 16:48:21 +08:00
parent b25cb13373
commit dbd9906bc6
13 changed files with 242 additions and 4 deletions

View File

@@ -24,6 +24,26 @@ kafka:
spring:
application:
name: kafka-console-ui
# h2 database
datasource:
# url: jdbc:h2:file:/data/demo
url: jdbc:h2:mem:testdb
driver-class-name: org.h2.Driver
username: sa
password: password
schema: classpath:db/schema-h2.sql
# data: classpath:db/data-h2.sql
h2:
console:
enabled: true
logging:
home: ./
home: ./
cron:
# clear-dirty-user: 0 * * * * ?
clear-dirty-user: 0 0 1 * * ?
#spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

View File

@@ -0,0 +1,5 @@
-- DELETE FROM t_kafka_user;
--
-- INSERT INTO t_kafka_user (id, username, password) VALUES
-- (1, 'Jone', 'p1'),
-- (2, 'Jack', 'p2');

View File

@@ -0,0 +1,12 @@
-- DROP TABLE IF EXISTS T_KAKFA_USER;
CREATE TABLE if not exists T_KAFKA_USER
(
ID IDENTITY NOT NULL COMMENT '主键ID',
USERNAME VARCHAR(50) NOT NULL DEFAULT '' COMMENT '姓名',
PASSWORD VARCHAR(50) NOT NULL DEFAULT '' COMMENT '年龄',
UPDATE_TIME TIMESTAMP NOT NULL DEFAULT NOW() COMMENT '更新时间',
PRIMARY KEY (ID),
UNIQUE (USERNAME)
);