Reputation: 471
There is maven flyway configuration that point to a general folder with all the migration scripts. Scripts have common patter like "V1.2.3.4__description". Also there are other .sql scripts in the same migrations folder that have arbityraty names. Is it possible to call/include external scripts (in the same folder) from inside regular flyway migration scripts?
Upvotes: 1
Views: 1055
Reputation: 121
There's no way to call external SQL scripts from your migrations, but you could maybe insert the external SQL into your migrations using placeholders. These allow you to insert configurable values using ${ ... }
.
E.g. your migration scripts could look like:
SOME SQL...
${external_sql}
SOME MORE SQL...
Then, you could configure the external SQL in flyway.conf
:
flyway.placeholders.external_sql=SOME EXTERNAL SQL...;
Or, if the external SQL needs to be loaded from files, you could configure the placeholder in the command line and set it's value to the contents of the external .sql
file. E.g. something like:
./flyway migrate "-placeholders.external_sql=$(cat ./sql/some_external_sql.sql)"
Upvotes: 0