Skip to content
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 initSql for all clients #1324

Closed
JeP42 opened this issue May 29, 2016 · 2 comments
Closed

Add initSql for all clients #1324

JeP42 opened this issue May 29, 2016 · 2 comments

Comments

@JeP42
Copy link

@JeP42 JeP42 commented May 29, 2016

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.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Nov 29, 2017

It should be easy to work around this for now with SQL callbacks.

@axelfontaine axelfontaine changed the title Feature Request: Capability to specify initSQL for command line tool Add initSql for all clients Sep 24, 2018
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Sep 24, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.