New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to provide variables in migrations #1104
Comments
One more consideration is not to break some old migrations which might use similar syntax in statements and were not going to use replacements. |
Proposing to add an additional parameter: <plugin>
<groupId>org.javalite</groupId>
<artifactId>db-migrator-maven-plugin</artifactId>
<version>${javalite.version}</version>
<configuration>
<environments>testenv</environments>
<migrationsPath>./src/main/db/migrations</migrationsPath>
<configFile>${project.basedir}/src/main/resources/database.properties</configFile>
<encoding>${project.build.sourceEncoding}</encoding>
<mergeProperties>${project.basedir}/src/main/resources/merge-testenv.properties</mergeProperties> <!-- new parameter proposed -->
</configuration>
<executions>
<execution>
<id>dev_migrations</id>
<phase>validate</phase>
<goals>
<goal>migrate</goal>
</goals>
</execution>
</executions>
</plugin>
|
Also, proposing to use a Mustache format:
inside the property file. |
need to add documentation to the site |
apparently, there is no way to specify different files for environments, we need to add that |
#1104 - Add ability to provide variables in migrations
This broke another test Caused by: java.lang.NullPointerException to reproduce:
this is the reason that docker has a port allocated. Cassandra starts but never shuts down |
@yanchevsky please, see the comment above |
#1104 - Add ability to provide variables in migrations - fix null poi…
#1104 - Add ability to provide variables in migrations - fix reset mojo
For example ${mysql_db}:
CREATE TABLE users (id UInt64, name String, status UInt8) ENGINE = MySQL('${mysql_address}', '${mysql_db}', 'users', 'root', 'secret');
The variables are then taken from app_config files depending on the environment. So we are able to provide different values for a example for development, test, and jenkins environment.
However, there should be a way to escape those variables for INSERT/UPDATE statement (maybe others as well):
INSERT INTO var_samples (id, sample, text) VALUES (1, '${var}', 'Please, use ${var} in your settings')
The above should go into DB without any replacements, even if there are some
var
s in the environment.The text was updated successfully, but these errors were encountered: