hsqldb

2023-01-30

java

平平静静地吃粗茶淡饭,胜于提心吊胆地吃大鱼大肉——伊索

分享一个数据库hsqldb

全名HyperSQL,官网:http://hsqldb.org/

HSQLDB - 100% Java Database,其最大特点是百分百Java的数据库

这里是它的文档:http://hsqldb.org/web/hsqlDocsFrame.html

当然我们spring-boot已有其依赖:

image-20230130221625065

引入即可使用

1
2
3
4
5
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>

无序配置,直接在resources下新建schema.sql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
drop table if exists user_info;
create table if not exists user_info
(
id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
name VARCHAR(30) DEFAULT NULL,
age INT DEFAULT NULL,
email VARCHAR(50) DEFAULT NULL,
mobile VARCHAR(50) DEFAULT NULL,
version INT DEFAULT 1,
gmt_deleted DATETIME DEFAULT '2001-01-01 00:00:00',
PRIMARY KEY (id)
);

drop table if exists user_role;
create table if not exists user_role
(
id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
user_id BIGINT DEFAULT NULL,
role_id VARCHAR(30) DEFAULT NULL,
PRIMARY KEY (id)
);


drop table if exists role_info;
create table if not exists role_info
(
id VARCHAR(30) NOT NULL,
role_name VARCHAR(30) DEFAULT NULL,
PRIMARY KEY (id)
);

直接运行

image-20230130222404035