Skip to content

Commit

Permalink
feat: Setup flyway for db migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
akbatra567 committed Apr 18, 2024
1 parent 0c4138d commit 7619c8e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fileignoreconfig:
- filename: src/main/resources/db/migration/V1__create_initial_schema.sql
checksum: 82a3da253739f280d901f4f20c1d11e65f5163a8a51780f880d332cdecb335b6
version: ""
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
db:
image: postgres:16
ports:
- 5434:5432
- 5432:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: root
Expand Down
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>10.11.0</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
<version>10.11.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>

<build>
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ springdoc.swagger-ui.path=/swagger-docs.html
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect

# Hibernate ddl auto (create, create-drop, validate, update)
# spring.jpa.hibernate.ddl-auto = update
# spring.jpa.hibernate.ddl-auto = create

flyway.user=postgres
flyway.password=root
8 changes: 8 additions & 0 deletions src/main/resources/db/migration/V1__create_initial_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE users(
id int,
first_name varchar(240),
last_name varchar(240),
email_address varchar(240),
username varchar(240),
password varchar(240)
);

0 comments on commit 7619c8e

Please sign in to comment.