Skip to content

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

Notifications You must be signed in to change notification settings

daggerok/mysql-r2dbc-spring-boot-2.7.x

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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