Add initSql for all clients #1324
Closed
Milestone
Comments
It should be easy to work around this for now with SQL callbacks. |
A new initSql property has now been added which allows one to pass in SQL statements to initialize a database connection immediately after Flyway opens it. |
axelfontaine
added a commit
to flyway/flywaydb.org
that referenced
this issue
Sep 24, 2018
dohrayme
pushed a commit
to dohrayme/flyway
that referenced
this issue
Feb 3, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Flyway's Java API provides capability to specify SQL statements which are executed right after the connection to the target database was established via Flyway.setDatasource (=> javadoc).
Flyway flyway = new Flyway();
// datasource with initilization SQL
flyway.setDataSource(url, user, password, initSQL);
flyway.setLocations("sql/migrations");
flyway.migrate();
This is very useful functionality as it allows to provide custom SQL statements to initialize the DB session which is used later to apply migrations.
Unfortunately, the command line tool does not provide similar functionality. Therefore, when using the command line tool it is not possible to initialize the DB session with custom SQL statements. There are scenarios in which the command line tool would be more appropriate than the Java API. However, if session initialization is mandatory it is not possible to actually use the command line tool for such scenarios. Therefore, adding this feature to the commad line tool would really be appreciated.
The text was updated successfully, but these errors were encountered: