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 Details

  • 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 is true (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

      public String getSeparator()
      Gets 'separator' setting.
      See Also:
    • setSeparator

      public void setSeparator(String separator)
      Sets statement separator in SQL scripts. Defaults to semi-colon if not set.
    • getSqlScriptEncoding

      public Charset getSqlScriptEncoding()
      Gets 'sqlScriptEncoding'.
      See Also:
    • setSqlScriptEncoding

      public void setSqlScriptEncoding(Charset sqlScriptEncoding)
      Sets the file encoding for SQL script file. Defaults to UTF-8 if not set.
    • getDbPlatformCode

      public String getDbPlatformCode()
      Gets 'dbPlatformCode'

      Note that this is an arbitrary value. It can be any string value.

      Returns:
      database platform code or null if the value isn't set.
      See Also:
    • setDbPlatformCode

      public void setDbPlatformCode(String dbPlatformCode)
      Sets the db engine code to use when finding which SQL script to execute, as in preliquibase/${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

      public List<String> getSqlScriptReferences()
      Gets the sqlScriptReferences
      See Also:
    • setSqlScriptReferences

      public void setSqlScriptReferences(List<String> sqlScriptReferences)
      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 to disabling the 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.SqlScriptRefError exception 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.