Class PreLiquibaseProperties
java.lang.Object
net.lbruun.springboot.preliquibase.PreLiquibaseProperties
@Validated
@ConfigurationProperties(prefix="preliquibase")
public class PreLiquibaseProperties
extends Object
Properties for Pre-Liquibase module.
- Author:
- lbruun
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets 'dbPlatformCode'Gets 'separator' setting.Gets 'sqlScriptEncoding'.Gets the sqlScriptReferencesbooleanGets 'continueOnError' setting.booleanGet the 'enabled' setting (if the module is enabled or not).voidsetContinueOnError(boolean continueOnError) Sets whether to stop if an error occurs while executing the SQL script.voidsetDbPlatformCode(String dbPlatformCode) Sets the db engine code to use when finding which SQL script to execute, as inpreliquibase/${dbEngineCode}.sql}.voidsetEnabled(boolean enabled) Disables or enables module.voidsetSeparator(String separator) Sets statement separator in SQL scripts.voidsetSqlScriptEncoding(Charset sqlScriptEncoding) Sets the file encoding for SQL script file.voidsetSqlScriptReferences(List<String> sqlScriptReferences) Sets location(s) of where to find the SQL script(s) to execute.
-
Field Details
-
PROPERTIES_PREFIX
- See Also:
-
DEFAULT_SCRIPT_LOCATION
- See Also:
-
-
Constructor Details
-
PreLiquibaseProperties
public PreLiquibaseProperties()
-
-
Method Details
-
isEnabled
public boolean isEnabled()Get the 'enabled' setting (if the module is enabled or not).- See Also:
-
setEnabled
public void setEnabled(boolean enabled) Disables or enables module. Default istrue(module is enabled). -
isContinueOnError
public boolean isContinueOnError()Gets 'continueOnError' setting.- See Also:
-
setContinueOnError
public void setContinueOnError(boolean continueOnError) Sets whether to stop if an error occurs while executing the SQL script. Default value is:false. -
getSeparator
Gets 'separator' setting.- See Also:
-
setSeparator
Sets statement separator in SQL scripts. Defaults to semi-colon if not set. -
getSqlScriptEncoding
Gets 'sqlScriptEncoding'. -
setSqlScriptEncoding
Sets the file encoding for SQL script file. Defaults toUTF-8if not set. -
getDbPlatformCode
Gets 'dbPlatformCode'Note that this is an arbitrary value. It can be any string value.
- Returns:
- database platform code or
nullif the value isn't set. - See Also:
-
setDbPlatformCode
Sets the db engine code to use when finding which SQL script to execute, as inpreliquibase/${dbEngineCode}.sql}.Setting this value explicitly overrides the database platform auto-detection. The value can be any value; it will not be validated.
- Parameters:
dbPlatformCode-
-
getSqlScriptReferences
Gets the sqlScriptReferences- See Also:
-
setSqlScriptReferences
Sets location(s) of where to find the SQL script(s) to execute.The value is interpreted slightly differently depending on its content:
- If the value is a Spring Resource textual reference which ends with
"/": In this case, the reference is expected to be a folder reference where SQL scripts can be found. From this folder: If a file named "DBPLATFORMCODE.sql" (e.g. "postgresql.sql") exists then that will be used. If no such file is found then a file named "default.sql" is used. If neither file is found then no action will be taken, similarly todisablingthe module.
Example values:
"classpath:my-folder/"(load from classpath folder).
"file:c:/config/sql-scripts/"(load from file system folder, Windows).
"file:/app/etc/sql-scripts/"(load from file system folder, Linux).
- Otherwise: The value is interpreted as a comma-separated list of Spring Resource textual
references to specific SQL files. Each script file will be executed in the order
they are listed. Before execution of any of of the script files it is checked if all
files mentioned in the list actually exists. If not, an
PreLiquibaseException.SqlScriptRefErrorexception is thrown.
Example value:"file:/foo/bar/myscript1.sql,file:/foo/bar/myscript2.sql".
Default value:
DEFAULT_SCRIPT_LOCATION.- Parameters:
sqlScriptReferences- list of Spring Resource references.
- If the value is a Spring Resource textual reference which ends with
-