Search code examples
javamysqlflyway

How to ignore placeholder expressions for Flyway?


I am using flyway version 2.3, I have an sql patch which inserts a varchar into a table having character sequence that Flyway treats as placeholders. I want to flyway to ignore placeholders and run the script as is.

The script file is

insert into test_data (value) values ("${Email}");

And the Java code is

package foobar;

import com.googlecode.flyway.core.Flyway;

public class App 
{
    public static void main( String[] args )
    {
        // Create the Flyway instance
        Flyway flyway = new Flyway();

        // Point it to the database
        flyway.setDataSource("jdbc:mysql://localhost:3306/flywaytest", "alpha", "beta");

        // Start the migration
        flyway.migrate();
    }
}

Solution

  • You can change the value of the placeholder suffix or prefix to a different value and you should be OK.