Skip to content

Commit 1ade8bc

Browse files
committed
added flyway dependency and migration script. auto baselining exisiting db
1 parent 9fa44e3 commit 1ade8bc

File tree

4 files changed

+53
-2
lines changed

4 files changed

+53
-2
lines changed

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@
4040
<artifactId>spring-boot-starter-test</artifactId>
4141
<scope>test</scope>
4242
</dependency>
43+
<!-- https://mvnrepository.com/artifact/org.flywaydb/flyway-maven-plugin -->
44+
<dependency>
45+
<groupId>org.flywaydb</groupId>
46+
<artifactId>flyway-maven-plugin</artifactId>
47+
<version>5.1.4</version>
48+
</dependency>
49+
50+
4351
<dependency>
4452
<groupId>com.1stleg</groupId>
4553
<artifactId>jnativehook</artifactId>

src/main/resources/application.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ spring.datasource.url=jdbc:h2:file:~/keeptime/db/keeptime-h2-db;DB_CLOSE_ON_EXIT
77
spring.datasource.username=sa
88
spring.datasource.password=
99
spring.datasource.driver-class-name=org.h2.Driver
10-
spring.jpa.hibernate.ddl-auto=update
10+
11+
spring.flyway.baselineOnMigrate=true
12+
spring.flyway.baselineVersion=0.0.0
13+
14+
spring.jpa.hibernate.ddl-auto=validate
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
CREATE TABLE IF NOT EXISTS project
2+
(
3+
id BIGINT GENERATED BY DEFAULT AS IDENTITY,
4+
color VARCHAR(255),
5+
index INTEGER NOT NULL,
6+
is_default BOOLEAN NOT NULL,
7+
is_enabled BOOLEAN NOT NULL,
8+
is_work BOOLEAN NOT NULL,
9+
name VARCHAR(255),
10+
PRIMARY KEY (id)
11+
);
12+
13+
CREATE TABLE IF NOT EXISTS settings
14+
(
15+
id BIGINT GENERATED BY DEFAULT AS IDENTITY,
16+
default_background_color VARCHAR(255),
17+
default_font_color VARCHAR(255),
18+
display_projects_right BOOLEAN NOT NULL,
19+
hover_background_color VARCHAR(255),
20+
hover_font_color VARCHAR(255),
21+
task_bar_color VARCHAR(255),
22+
use_hotkey BOOLEAN NOT NULL,
23+
PRIMARY KEY (id)
24+
);
25+
26+
CREATE TABLE IF NOT EXISTS work
27+
(
28+
id BIGINT GENERATED BY DEFAULT AS IDENTITY,
29+
creation_date DATE,
30+
end_time TIMESTAMP,
31+
notes CLOB,
32+
start_time TIMESTAMP,
33+
project_id BIGINT,
34+
PRIMARY KEY (id)
35+
);
36+
37+
ALTER TABLE work
38+
ADD CONSTRAINT IF NOT EXISTS fkf4jf1abybj7fc5w1nt686svxt FOREIGN KEY (project_id) REFERENCES
39+
project;

src/main/resources/logback.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<logger name="de.doubleslash" level="debug" />
1919

20-
<root level="error">
20+
<root level="info">
2121
<appender-ref ref="STDOUT" />
2222
<appender-ref ref="rollingFile" />
2323
</root>

0 commit comments

Comments
 (0)