Class DbMigrationConfig

    • Method Detail

      • getPlatform

        public io.ebean.annotation.Platform getPlatform()
        Return the DB platform to generate migration DDL for.

        We typically need to explicitly specify this as migration can often be generated when running against H2.

      • setPlatform

        public void setPlatform​(io.ebean.annotation.Platform platform)
        Set the DB platform to generate migration DDL for.
      • getMigrationPath

        public String getMigrationPath​(boolean dbinitMigration)
        Return the path for normal migrations or dbinit migrations.
        Parameters:
        dbinitMigration - When true return the path for dbinit migrations.
      • setMigrationPath

        public void setMigrationPath​(String migrationPath)
        Set the resource path for db migrations.

        The default of "dbmigration" is reasonable in most cases. You may look to set this to be something like "dbmigration/myapp" where myapp gives it a unique resource path in the case there are multiple Database applications in the single classpath.

      • getModelPath

        public String getModelPath()
        Return the relative path for the model files (defaults to model).
      • setModelPath

        public void setModelPath​(String modelPath)
        Set the relative path for the model files.
      • setApplySuffix

        public void setApplySuffix​(String applySuffix)
        Set the apply script suffix (defaults to sql).
      • setApplyPrefix

        public void setApplyPrefix​(String applyPrefix)
        Set the apply prefix. This might be set to "V" for use with FlywayDB.
      • getMetaTable

        public String getMetaTable()
        Return the table name that holds the migration run details (used by DB Migration runner only).
      • setMetaTable

        public void setMetaTable​(String metaTable)
        Set the table name that holds the migration run details (used by DB Migration runner only).
      • getRunPlaceholders

        public String getRunPlaceholders()
        Return a comma and equals delimited placeholders that are substituted in SQL scripts when running migration (used by DB Migration runner only).
      • setRunPlaceholders

        public void setRunPlaceholders​(String runPlaceholders)
        Set a comma and equals delimited placeholders that are substituted in SQL scripts when running migration (used by DB Migration runner only).
      • getRunPlaceholderMap

        public Map<String,​StringgetRunPlaceholderMap()
        Return a map of placeholder values that are substituted in SQL scripts when running migration (used by DB Migration runner only).
      • setRunPlaceholderMap

        public void setRunPlaceholderMap​(Map<String,​String> runPlaceholderMap)
        Set a map of placeholder values that are substituted when running migration (used by DB Migration runner only).
      • isRunMigration

        public boolean isRunMigration()
        Return true if the DB migration should be run on startup.
      • setRunMigration

        public void setRunMigration​(boolean runMigration)
        Set to true to run the DB migration on startup.
      • getDbUsername

        public String getDbUsername()
        Return the DB username to use for running DB migrations.
      • setDbUsername

        public void setDbUsername​(String dbUsername)
        Set the DB username to use for running DB migrations.
      • getDbPassword

        public String getDbPassword()
        Return the DB password to use for running DB migrations.
      • setDbPassword

        public void setDbPassword​(String dbPassword)
        Set the DB password to use for running DB migrations.
      • getDbSchema

        public String getDbSchema()
        Return the DB schema to use (for migration, testing etc).
      • setDbSchema

        public void setDbSchema​(String dbSchema)
        Set the Db schema to use.
      • setDefaultDbSchema

        public void setDefaultDbSchema​(String dbSchema)
        Set the Db schema if it hasn't already been defined.
      • isDefaultDbSchema

        public boolean isDefaultDbSchema()
        Return true if this is considered the default DB schema (Postgres schema matching DB username).
      • getPatchInsertOn

        public String getPatchInsertOn()
        Return migration versions that should be added to history without running.
      • setPatchInsertOn

        public void setPatchInsertOn​(String patchInsertOn)
        Set migration versions that should be added to history without running.

        Value can be a string containing comma delimited list of version numbers.

      • getDdlHeader

        public String getDdlHeader()
        Returns a DDL header prepend for each DDL. E.g. for copyright headers You can use placeholders like ${version} or ${timestamp} in properties file.
      • setDdlHeader

        public void setDdlHeader​(String ddlHeader)
        Set the header prepended to the DDL.
      • setPatchResetChecksumOn

        public void setPatchResetChecksumOn​(String patchResetChecksumOn)
        Set migration versions that should have their checksum reset and not run.

        Value can be a string containing comma delimited list of version numbers.

      • isStrictMode

        public boolean isStrictMode()
        Return true if strict mode is used which includes a check that non-null columns have a default value.
      • setStrictMode

        public void setStrictMode​(boolean strictMode)
        Set to false to turn off strict mode allowing non-null columns to not have a default value.
      • getRunnerConfig

        public io.ebean.migration.MigrationConfig getRunnerConfig()
        Return the underlying migration runner configuration allowing for more advanced settings.
      • createRunner

        public io.ebean.migration.MigrationRunner createRunner​(ClassLoader classLoader,
                                                               Properties properties)
        Create the MigrationRunner to run migrations if necessary.