Note that there are some explanatory texts on larger screens.

plurals
  1. POPlaceholder replacement not working with flyway test extensions
    text
    copied!<p>I'm trying to use placeholders with flyway test extension 1.7.0. I defined a placeholder in flyway.properties:</p> <pre><code> flyway.placeholders.schema_name=MYSCHEMA </code></pre> <p>My sql script looks like that:</p> <pre><code> create schema ${schema_name}; </code></pre> <p>When running the flyway test, I'm getting the following error:</p> <pre><code>117157 [main] DEBUG com.googlecode.flyway.core.migration.sql.SqlScript - Found statement at line 1: create schema ${schema_name}; 117157 [main] DEBUG com.googlecode.flyway.core.migration.sql.SqlStatement - Executing SQL: create schema ${schema_name} 117157 [main] ERROR com.googlecode.flyway.core.migration.DbMigrator - com.googlecode.flyway.core.exception.FlywayException: Error executing statement at line 1: create schema ${schema_name} 117158 [main] ERROR com.googlecode.flyway.core.migration.DbMigrator - Caused by org.hsqldb.HsqlException: Unknown JDBC escape sequence: {: {schema_name} 117158 [main] DEBUG com.googlecode.flyway.core.migration.DbMigrator - Finished migrating to version 1.1 (execution time 00:00.005s) </code></pre> <p>So it looks like the placeholder replacement is not working. By the way, my flyway.properties file is loaded successfully (I'm using it for other values like jdbc url, too).</p> <p>Does someone know what could be the problem here?</p> <p><strong>EDIT1</strong> It looks like the configure method in the Flyway class is not called. Do I have to add something to the application context?</p> <p><strong>EDIT2</strong> One solution we found is to set the placeholders in the applicationcontext:</p> <pre><code>&lt;bean id="flyway" class="com.googlecode.flyway.core.Flyway" depends-on="dataSourceRef"&gt; &lt;property name="dataSource" ref="dataSourceRef" /&gt; &lt;property name="placeholders" &gt; &lt;map&gt; &lt;entry key="schema_name" value="${flyway.placeholders.schema_name}" /&gt; &lt;/map&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre> <p>But we are still looking for a better solution ...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload