Skip to content

Commit b4e1cc3

Browse files
committed
added lightweight h2 database (ORACLE mode) default option for easy testing and demos
1 parent 7709523 commit b4e1cc3

File tree

4 files changed

+52
-3
lines changed

4 files changed

+52
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
target/
33
nohup.out
44
.vscode/
5-
split_tests.sh
5+
split_tests.sh
6+
*.db

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@
7171
<version>19.3.0.0</version>
7272
</dependency>
7373

74+
<dependency>
75+
<groupId>com.h2database</groupId>
76+
<artifactId>h2</artifactId>
77+
<scope>runtime</scope>
78+
</dependency>
79+
7480
<!-- <dependency>
7581
<groupId>org.testng</groupId>
7682
<artifactId>testng</artifactId>
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:49161/xe
1+
# spring.datasource.url=jdbc:oracle:thin:@localhost:1521/xe
2+
spring.datasource.url=jdbc:h2:file:./testdb;Mode=Oracle
23
spring.datasource.username=SYSTEM
34
spring.datasource.password=oracle
4-
spring.liquibase.change-log=classpath:db/changelog/changelog_version-3.2.oracle.sql
5+
spring.liquibase.change-log=classpath:db/changelog/changelog_version-3.3.oracle.xml
56
server.port=8086
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
4+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
5+
6+
<!-- create a sales table with id, Item name, amount, quantity, and date. Auto increment id. -->
7+
<changeSet id="1" author="jim">
8+
<createTable tableName="sales">
9+
<column name="id" type="int" autoIncrement="true">
10+
<constraints primaryKey="true" nullable="false" />
11+
</column>
12+
<column name="item" type="varchar(100)" />
13+
<column name="amount" type="double" />
14+
<column name="quantity" type="int" />
15+
<column name="date" type="date" />
16+
</createTable>
17+
</changeSet>
18+
19+
<!-- insert some data into the sales table. -->
20+
<changeSet id="2" author="jim">
21+
<insert tableName="sales">
22+
<column name="item" value="Laptop" />
23+
<column name="amount" value="1000" />
24+
<column name="quantity" value="5" />
25+
<column name="date" value="2020-01-01" />
26+
</insert>
27+
<insert tableName="sales">
28+
<column name="item" value="Desktop" />
29+
<column name="amount" value="1500" />
30+
<column name="quantity" value="2" />
31+
<column name="date" value="2020-01-02" />
32+
</insert>
33+
<insert tableName="sales">
34+
<column name="item" value="Printer" />
35+
<column name="amount" value="500" />
36+
<column name="quantity" value="10" />
37+
<column name="date" value="2020-01-03" />
38+
</insert>
39+
</changeSet>
40+
41+
</databaseChangeLog>

0 commit comments

Comments
 (0)