An open API service indexing awesome lists of open source software.

https://github.com/sanogotech/liquidbasestarter

LiquidBase DB Changelog Starter
https://github.com/sanogotech/liquidbasestarter

dbmigration h2 h2-database java liquibase spring spring-boot

Last synced: 27 days ago
JSON representation

LiquidBase DB Changelog Starter

Awesome Lists containing this project

README

          

# liquidbasestarter
LiquidBase DB Changelog Starter

* Best Sample : https://github.com/sanogotech/liquibase-springboot

## Docs
- https://www.techgeeknext.com/spring-boot/spring-boot-liquibase-example#google_vignette
- https://www.baeldung.com/liquibase-refactor-schema-of-java-app
- https://docs.liquibase.com/tools-integrations/springboot/using-springboot-with-maven.html
- https://reflectoring.io/database-migration-spring-boot-liquibase/

## Dependencies

```

org.springframework.boot
spring-boot-starter-parent
2.5.3


org.liquibase
liquibase-core



org.springframework.boot
spring-boot-starter-data-jpa

```

## application.properties

```
spring.liquibase.change-log=classpath:liquibase-changeLog.xml *.sql or xml or json or yaml
spring.liquibase.enabled=false

```

## liquibase.properties

```
Windows example: changelog-file: ..\path\to\changelog.sql
Linux example: changelog-file: ../path/to/changelog.sql

url=jdbc:mysql://localhost:3306/oauth_reddit
username=tutorialuser
password=tutorialmy5ql
driver=com.mysql.jdbc.Driver
outputChangeLogFile=src/main/resources/liquibase-outputChangeLog.xml
```
## Changelog example

```xml








```
## Generate a ChangeLog From an Existing Database

```

org.liquibase
liquibase-maven-plugin
3.4.1


org.liquibase
liquibase-maven-plugin
3.4.1

src/main/resources/liquibase.properties

```

```
mvn liquibase:generateChangeLog
```

## Generate a ChangeLog From Diffs Between Two Databases

```
mvn liquibase:diff

```

* liquibase.properties
```
changeLogFile=src/main/resources/liquibase-changeLog.xml
url=jdbc:mysql://localhost:3306/oauth_reddit
username=tutorialuser
password=tutorialmy5ql
driver=com.mysql.jdbc.Driver
referenceUrl=jdbc:h2:mem:oauth_reddit
diffChangeLogFile=src/main/resources/liquibase-diff-changeLog.xml
referenceDriver=org.h2.Driver
referenceUsername=sa
referencePassword=
```

## To roll back any changes

```
create the liquibase.rollback-file file in Spring Boot and generate a rollback script for changes associated with changesets
Ex:
-- rollback drop table test_table;
```