documentation/Reference/Configuration/Environments Namespace/Environment Init SQL Setting.md
SQL statements to be run immediately after a database connection has been established.
This is mainly used for setting some state on the connection that needs to be shared across all scripts, or should not be included into any one script.
This could effectively be considered an environment specific afterConnect callback.
Please note that this parameter defines an "Initial SQL command," not an "Initialization SQL command." It may be executed multiple times, as it runs immediately after each database connection is established.
String
<i>none</i>
This can't be set in a config file via Flyway Desktop, although it will be honoured, and it can be configured as an advanced parameter in operations on the Migrations page.
./flyway -initSql="ALTER SESSION SET NLS_LANGUAGE='ENGLISH';" info
To configure a named environment via command line when using a TOML configuration, prefix initSql with
environments.{environment name}. for example:
./flyway "-environments.sample.initSql=ALTER SESSION SET NLS_LANGUAGE='ENGLISH';" info
[environments.default]
initSql = "ALTER SESSION SET NLS_LANGUAGE='ENGLISH';"
flyway.initSql=ALTER SESSION SET NLS_LANGUAGE='ENGLISH';
FLYWAY_INIT_SQL=ALTER SESSION SET NLS_LANGUAGE='ENGLISH';
Flyway.configure()
.initSql("ALTER SESSION SET NLS_LANGUAGE='ENGLISH';")
.load()
flyway {
initSql = "ALTER SESSION SET NLS_LANGUAGE='ENGLISH';"
}
<configuration>
<initSql>ALTER SESSION SET NLS_LANGUAGE='ENGLISH';</initSql>
</configuration>