Closed aikendaniel closed 2 years ago
@aikendaniel I think it can be something like "premigration script", in general it can be creating database, creating user and so on.
E. g.
r2dbc.migrate.pre-migrations-script="CREATE SCHEMA IF NOT EXISTS myschema;"
That works for my use case! Would pointing to a .sql
file be more flexible for multi-line scripts, though?
Would pointing to a .sql file be more flexible for multi-line scripts
Interesting suggestion, I will explore how to reuse existing mechanisms to load those scripts.
I've pushed 1.8.6 version. It gonna be available at Maven Central after some time. TL;DR;
V0__create_schemas__premigration.sql
CREATE SCHEMA IF NOT EXISTS "my premigrable scheme";
Thank you for the quick fix! I will get it into my project.
If we are specifying a non-default schema to use and the database is empty, the migration fails because the schema does not exist. It would be great to have r2dbc-migrate create the schema that is specified via
r2dbc.migrate.migrations-schema
if it does not exist.I observed this behavior when using Postgres and a Spring Boot app. I understand that I can probably use a
SqlR2dbcScriptDatabaseInitializer
, but I think this feature should be baked into the library instead.