public class DbMigrationConfig extends Object
Constructor and Description |
---|
DbMigrationConfig() |
Modifier and Type | Method and Description |
---|---|
io.ebean.migration.MigrationRunner |
createRunner(ClassLoader classLoader,
Properties properties)
Create the MigrationRunner to run migrations if necessary.
|
String |
getApplyPrefix()
Return the apply prefix.
|
String |
getApplySuffix()
Return the apply script suffix (defaults to sql).
|
String |
getDbPassword()
Return the DB password to use for running DB migrations.
|
String |
getDbSchema()
Return the DB schema to use (for migration, testing etc).
|
String |
getDbUsername()
Return the DB username to use for running DB migrations.
|
String |
getDdlHeader()
Returns a DDL header prepend for each DDL.
|
String |
getMetaTable()
Return the table name that holds the migration run details
(used by DB Migration runner only).
|
String |
getMigrationPath()
Return the resource path for db migrations.
|
String |
getMigrationPath(boolean dbinitMigration)
Return the path for normal migrations or dbinit migrations.
|
String |
getModelPath()
Return the relative path for the model files (defaults to model).
|
String |
getModelSuffix()
Return the model suffix (defaults to model.xml)
|
String |
getPatchInsertOn()
Return migration versions that should be added to history without running.
|
String |
getPatchResetChecksumOn()
Return migration versions that should have their checksum reset and not run.
|
io.ebean.annotation.Platform |
getPlatform()
Return the DB platform to generate migration DDL for.
|
io.ebean.migration.MigrationConfig |
getRunnerConfig()
Return the underlying migration runner configuration allowing for more advanced settings.
|
Map<String,String> |
getRunPlaceholderMap()
Return a map of placeholder values that are substituted in SQL scripts when running migration
(used by DB Migration runner only).
|
String |
getRunPlaceholders()
Return a comma and equals delimited placeholders that are substituted in SQL scripts when running migration
(used by DB Migration runner only).
|
boolean |
isDefaultDbSchema()
Return true if this is considered the default DB schema (Postgres schema matching DB username).
|
boolean |
isRunMigration()
Return true if the DB migration should be run on startup.
|
boolean |
isStrictMode()
Return true if strict mode is used which includes a check that non-null columns have a default value.
|
void |
loadSettings(PropertiesWrapper properties,
String serverName)
Load the settings from the PropertiesWrapper.
|
void |
setApplyPrefix(String applyPrefix)
Set the apply prefix.
|
void |
setApplySuffix(String applySuffix)
Set the apply script suffix (defaults to sql).
|
void |
setDbPassword(String dbPassword)
Set the DB password to use for running DB migrations.
|
void |
setDbSchema(String dbSchema)
Set the Db schema to use.
|
void |
setDbUsername(String dbUsername)
Set the DB username to use for running DB migrations.
|
void |
setDdlHeader(String ddlHeader)
Set the header prepended to the DDL.
|
void |
setDefaultDbSchema(String dbSchema)
Set the Db schema if it hasn't already been defined.
|
void |
setMetaTable(String metaTable)
Set the table name that holds the migration run details
(used by DB Migration runner only).
|
void |
setMigrationPath(String migrationPath)
Set the resource path for db migrations.
|
void |
setModelPath(String modelPath)
Set the relative path for the model files.
|
void |
setModelSuffix(String modelSuffix)
Set the model suffix.
|
void |
setPatchInsertOn(String patchInsertOn)
Set migration versions that should be added to history without running.
|
void |
setPatchResetChecksumOn(String patchResetChecksumOn)
Set migration versions that should have their checksum reset and not run.
|
void |
setPlatform(io.ebean.annotation.Platform platform)
Set the DB platform to generate migration DDL for.
|
void |
setRunMigration(boolean runMigration)
Set to true to run the DB migration on startup.
|
void |
setRunPlaceholderMap(Map<String,String> runPlaceholderMap)
Set a map of placeholder values that are substituted when running migration
(used by DB Migration runner only).
|
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).
|
void |
setStrictMode(boolean strictMode)
Set to false to turn off strict mode allowing non-null columns to not have a default value.
|
public DbMigrationConfig()
public io.ebean.annotation.Platform getPlatform()
We typically need to explicitly specify this as migration can often be generated when running against H2.
public void setPlatform(io.ebean.annotation.Platform platform)
public String getMigrationPath(boolean dbinitMigration)
dbinitMigration
- When true return the path for dbinit migrations.public String getMigrationPath()
public void setMigrationPath(String migrationPath)
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 EbeanServer applications in the single classpath.
public String getModelPath()
public void setModelPath(String modelPath)
public String getModelSuffix()
public void setModelSuffix(String modelSuffix)
public String getApplySuffix()
public void setApplySuffix(String applySuffix)
public String getApplyPrefix()
public void setApplyPrefix(String applyPrefix)
public String getMetaTable()
public void setMetaTable(String metaTable)
public String getRunPlaceholders()
public void setRunPlaceholders(String runPlaceholders)
public Map<String,String> getRunPlaceholderMap()
public void setRunPlaceholderMap(Map<String,String> runPlaceholderMap)
public boolean isRunMigration()
public void setRunMigration(boolean runMigration)
public String getDbUsername()
public void setDbUsername(String dbUsername)
public String getDbPassword()
public void setDbPassword(String dbPassword)
public String getDbSchema()
public void setDbSchema(String dbSchema)
public void setDefaultDbSchema(String dbSchema)
public boolean isDefaultDbSchema()
public String getPatchInsertOn()
public void setPatchInsertOn(String patchInsertOn)
Value can be a string containing comma delimited list of version numbers.
public String getPatchResetChecksumOn()
public String getDdlHeader()
public void setDdlHeader(String ddlHeader)
public void setPatchResetChecksumOn(String patchResetChecksumOn)
Value can be a string containing comma delimited list of version numbers.
public boolean isStrictMode()
public void setStrictMode(boolean strictMode)
public io.ebean.migration.MigrationConfig getRunnerConfig()
public void loadSettings(PropertiesWrapper properties, String serverName)
public io.ebean.migration.MigrationRunner createRunner(ClassLoader classLoader, Properties properties)
Copyright © 2019. All rights reserved.