Create Database

Overview

Once PostgreSQL (v10) has been installed and the basic setup is done, we use Flyway to create the tables.

Steps

Enable Flyway Migration

  1. Configure the below properties in the application.properties file to enable flyway migration:

spring.flyway.url=jdbc:postgresql://localhost:5432/birthregn
spring.flyway.user=birth
spring.flyway.password=birth #REPLACE
spring.flyway.table=public
spring.flyway.baseline-on-migrate=true
spring.flyway.outOfOrder=true
spring.flyway.locations=classpath:/db/migration/main
spring.flyway.enabled=true
  1. Add the Flyway SQL scripts in the following structure under resources/db/migration/main:

  1. Add the migration files to the main folder. Follow the specified nomenclature while naming the file. The file name should be in the following format:

Example: V20180920110535__tl_tradelicense_ddl.sql

For this sample service, use the following SQL script to create the required tables.

Last updated

Was this helpful?