zonkyio / embedded-database-spring-test

A library for creating isolated embedded databases for Spring-powered integration tests.
Apache License 2.0
399 stars 37 forks source link

Init scripit #187

Closed komaroffdd closed 2 years ago

komaroffdd commented 2 years ago

Hello!

I have a question, how to execute init script(example CREATE DATABASE; CREATE some_user;) before migrations;

Suite Migrations are rolled under users in the database, so before migrations we need to roll the init script. Thanks!

tomix26 commented 2 years ago

Hi, I think that it should be possible to prepare a special test liquibase changelog to include the main changelog and also some additional testing migrations/operations. Check out this page: https://docs.liquibase.com/concepts/advanced/include.html

If this solution is not suitable for you, you can also use ResourceDatabasePopulator to initialize the database manually, and register it using DatabaseInitializerDetector or BeanPostProcessor.

komaroffdd commented 2 years ago

Hello thanks! I will try both options and return to this thread with some solution