A simple Spring Boot project demonstrating how to use Liquibase for database version control.
- Java 21
- Spring Boot
- Spring Data JPA
- PostgreSQL
- Liquibase
- Gradle
- Create Todo records
- Database schema management with Liquibase
- Insert initial data using Liquibase changeSets
src/main/resources/db/changelog
│
├── master.xml
├── 001-create-to-ddo-table.xml
├── 002-add-status-column.xml
├── 003-insert-to-do.xml
├── 004-insert-with-csv.xml
├── master.xml
└── todo.csv
Configure PostgreSQL credentials in application.yml.
spring:
datasource:
url: jdbc:postgresql://localhost:5432/todo_db
username: postgres
password: your_password
jpa:
hibernate:
ddl-auto: validate
liquibase:
change-log: classpath:db/changelog/master.xmlgit clone <repository-url>
cd <project-folder>
Linux / Mac:
./gradlew bootRun
Windows:
gradlew.bat bootRunWhen the application starts, Liquibase automatically:
- Creates the
todostable. - Adds the
idandnamecolumn. - Modify the
idcolumn type. - Adds the
statuscolumn. - Inserts sample data.
This project was created for practicing:
- Liquibase changeSets
- Database migrations
- Spring Boot and PostgreSQL integration
- Schema versioning
- Seed data insertion