Dynamic table names in snowflake with FLYWAY

46 Views Asked by At

I want to have 1 migration scripts in flyway, where I will have a create table statement. I would like to have dynamically name of the table with the use of placeholders, which will create as many tables as the number of prefixes I define.

How my migration looks like:

CREATE OR REPLACE TABLE ${prefix}_table(
    id int
)

and then in bash I execute:

prefixes=(PREFIX_1 PREFIX_2)
for prefix in "${prefixes[@]}"
do
    flyway migrate -placeholders.prefix="$prefix"
done

Unfortunately only 1st table with PREFIX_1 is created for 2nd loop iteration I have information that:

*Current version of schema TEST: 1 Schema TEST is up to date. No migration necessary. *

0

There are 0 best solutions below