Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fabianogoes/demo-spring-migration
https://github.com/fabianogoes/demo-spring-migration
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fabianogoes/demo-spring-migration
- Owner: fabianogoes
- Created: 2020-02-10T23:34:19.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-10T23:39:07.000Z (almost 5 years ago)
- Last Synced: 2024-10-17T01:59:16.161Z (2 months ago)
- Language: Kotlin
- Size: 55.7 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Demo Spring Boot Migration with Flyway
- Add Gradle plugin: `id("org.flywaydb.flyway") version "6.2.2"`
- To configure Spring properties default: `application.properties`
```
spring.datasource.url=jdbc:postgresql://localhost:5432/demo
spring.datasource.username=postgres
spring.datasource.password=postgresspring.jpa.show-sql=true
spring.jpa.generate-ddl=false
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.properties.hibernate.format_sql=falsespring.flyway.enabled=false
logging.level.root=INFO
logging.level.org.flywaydb=DEBUG
logging.level.org.springframework=INFO
logging.level.org.hibernate=ERROR
```
- To configure Spring properties dbmigration: `application-dbmigration.properties`
```
spring.main.web-application-type=nonespring.flyway.enabled=true
spring.flyway.locations=classpath:db/migration
```- Running Postgres by docker:
```
sudo docker run -p 5432:5432 -d \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_DB=demo \
-v pgdata:/var/lib/postgresql/data \
postgres
```- Running application in **default** mode: `SPRING_PROFILES_ACTIVE=default ./gradlew clean bootRun`
:warning: In this mode you **should not** run migration
- Running application in **dbmigration** mode: `SPRING_PROFILES_ACTIVE=dbmigration ./gradlew clean bootRun`
:information_source: In this mode you **should** run migration