Skip to content

Latest commit

 

History

History
95 lines (78 loc) · 5.21 KB

README.md

File metadata and controls

95 lines (78 loc) · 5.21 KB

R2DBC Liquibase Spring Boot 2.7.x MySQL CI

R2DBC Liquibase Spring Boot starter. This repository demonstrates Spring Boot R2DBC MySQL support

Table of content

Steps

Simple databaseClient use: SELECT 1 query with local mysql in docker. Check v0-simple-database-client-select-with-mysql-in-docker tag for details

Database migration using simple schema.sql and data.sql init scripts. Check v1-database-migrations-using-SqlInitializationProperties tag for details

More advanced database migration using custom R2DBC Liquibase migration tool Spring Boot starter. Check v2-database-migrations-using-custom-r2dbc-liquibase-spring-boot-starter tag for details

Use TestContainers to simplify development workflow. Check v3-add-test-containers-support tag for details

Getting started

Test:

/mvnw

Run for integration test:

if [[ "" != `docker ps -aq` ]] ; then docker rm -f -v `docker ps -aq` ; fi

docker run -d --rm --name mysql --platform=linux/x86_64 \
  --health-cmd='mysqladmin ping -h 127.0.0.1 -u $MYSQL_USER --password=$MYSQL_PASSWORD || exit 1' \
  --health-start-period=1s --health-retries=1111 --health-interval=1s --health-timeout=5s \
  -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=database \
  -e MYSQL_USER=user -e MYSQL_PASSWORD=password \
  -p 3306:3306 \
  mysql:8.0.24

while [[ $(docker ps -n 1 -q -f health=healthy -f status=running | wc -l) -lt 1 ]] ; do sleep 3 ; echo -n '.' ; done ; sleep 15; echo 'MySQL is ready.'

./mvnw clean compile spring-boot:run

docker stop mysql