Search code examples
unit-testingflyway

Best practice to tackle flyway migrations where statements are not understood in H2 database for unit testing


I have a flyway migration file which has among others the following command:

grant all privileges on schema public to ${admin_user} with grant option;`

Now I also want to unit test the sql files using an H2 database. But even with turned on MODE=PostgreSQL the grant statement is problematic as it is not understood by the H2 database. So what is the best practice here to tackle this kind of dialect problems?


Solution

  • From the FAQ, What is the best strategy for handling database-specific sql?: https://flywaydb.org/documentation/faq#db-specific-sql