public class Migrator extends Object
Migrator class.
Modifier and Type | Field and Description |
---|---|
static String |
LIQUIBASE_CHANGELOG_FILENAME |
static String |
LIQUIBASE_CHANGELOG_LOCATION_PATTERN |
Constructor and Description |
---|
Migrator() |
Modifier and Type | Method and Description |
---|---|
void |
addTimescaleDBExtension() |
void |
checkTime() |
void |
checkUnicode()
checkUnicode
|
void |
createDatabase()
createDatabase
|
void |
createLangPlPgsql()
createLangPlPgsql
|
static java.util.function.Predicate<org.springframework.core.io.Resource> |
createProductionLiquibaseChangelogFilter() |
void |
createSchema() |
void |
createUser()
createUser
|
boolean |
databaseExists()
databaseExists
|
boolean |
databaseExists(String databaseName) |
void |
databaseSetOwner()
databaseSetUser
|
boolean |
databaseUserExists()
databaseUserExists
|
void |
dropDatabase()
dropDatabase
|
void |
dropExistingIpLike() |
DataSource |
getAdminDataSource()
getAdminDataSource
|
String |
getAdminPassword()
getAdminPassword
|
String |
getAdminUser()
getAdminUser
|
org.springframework.context.ApplicationContext |
getApplicationContext() |
static String |
getClassLoaderUrls(ClassLoader classLoader) |
String |
getContextClassLoaderUrls() |
String |
getDatabaseName()
getDatabaseName
|
String |
getDatabasePassword()
getDatabasePassword
|
String |
getDatabaseUser()
getDatabaseUser
|
Float |
getDatabaseVersion()
getDatabaseVersion
|
DataSource |
getDataSource()
getDataSource
|
Collection<org.springframework.core.io.Resource> |
getLiquibaseChangelogs(boolean required) |
static String |
getLiquibaseContexts() |
static String |
getResourceLoaderClassLoaderUrls(org.springframework.core.io.ResourceLoader resourceLoader) |
String |
getSchemaName() |
static String |
getSystemClassLoaderUrls() |
boolean |
isIpLikeUsable()
isIpLikeUsable
|
void |
migrate(org.springframework.core.io.Resource changelog)
migrate
|
void |
prepareDatabase()
prepareDatabase
|
boolean |
schemaExists() |
void |
setAdminDataSource(DataSource dataSource)
setAdminDataSource
|
void |
setAdminPassword(String adminPassword)
setAdminPassword
|
void |
setAdminUser(String adminUser)
setAdminUser
|
void |
setApplicationContext(org.springframework.context.ApplicationContext context) |
void |
setCreateDatabase(boolean createDatabase)
setCreateDatabase
|
void |
setCreateUser(boolean createUser)
setCreateUser
|
void |
setDatabaseName(String databaseName)
setDatabaseName
|
void |
setDatabasePassword(String databasePassword)
setDatabasePassword
|
void |
setDatabaseUser(String databaseUser)
setDatabaseUser
|
void |
setDataSource(DataSource dataSource)
setDataSource
|
void |
setLiquibaseChangelogFilter(java.util.function.Predicate<org.springframework.core.io.Resource> tester) |
void |
setSchemaName(String schemaName) |
void |
setupDatabase(boolean updateDatabase,
boolean vacuum,
boolean fullVacuum,
boolean iplike,
boolean timescaleDB) |
void |
setupPlPgsqlIplike()
setupPlPgsqlIplike
|
void |
setValidateDatabaseVersion(boolean validate)
setValidateDatabaseVersion
|
void |
updateIplike()
updateIplike
|
void |
vacuumDatabase(boolean full)
vacuumDatabase
|
void |
validateDatabaseVersion()
validateDatabaseVersion
|
public static final String LIQUIBASE_CHANGELOG_FILENAME
public static final String LIQUIBASE_CHANGELOG_LOCATION_PATTERN
public static java.util.function.Predicate<org.springframework.core.io.Resource> createProductionLiquibaseChangelogFilter()
public DataSource getDataSource()
getDataSource
DataSource
object.public void setDataSource(DataSource dataSource)
setDataSource
dataSource
- a DataSource
object.public DataSource getAdminDataSource()
getAdminDataSource
DataSource
object.public void setAdminDataSource(DataSource dataSource)
setAdminDataSource
dataSource
- a DataSource
object.public void setValidateDatabaseVersion(boolean validate)
setValidateDatabaseVersion
validate
- a boolean.public void setCreateUser(boolean createUser)
setCreateUser
createUser
- a boolean.public void setCreateDatabase(boolean createDatabase)
setCreateDatabase
createDatabase
- a boolean.public void setLiquibaseChangelogFilter(java.util.function.Predicate<org.springframework.core.io.Resource> tester)
public void setDatabaseName(String databaseName)
setDatabaseName
databaseName
- a String
object.public String getSchemaName()
public void setSchemaName(String schemaName)
public void setDatabaseUser(String databaseUser)
setDatabaseUser
databaseUser
- a String
object.public String getDatabasePassword()
getDatabasePassword
String
object.public void setDatabasePassword(String databasePassword)
setDatabasePassword
databasePassword
- a String
object.public void setAdminUser(String adminUser)
setAdminUser
adminUser
- a String
object.public void setAdminPassword(String adminPassword)
setAdminPassword
adminPassword
- a String
object.public Float getDatabaseVersion() throws MigrationException
getDatabaseVersion
Float
object.MigrationException
- if any.public void validateDatabaseVersion() throws MigrationException
validateDatabaseVersion
MigrationException
- if any.public void createLangPlPgsql() throws MigrationException
createLangPlPgsql
MigrationException
- if any.public boolean databaseUserExists() throws MigrationException
databaseUserExists
MigrationException
- if any.public void createUser() throws MigrationException
createUser
MigrationException
- if any.public boolean databaseExists() throws MigrationException
databaseExists
MigrationException
- if any.public boolean databaseExists(String databaseName) throws MigrationException
MigrationException
public void createSchema() throws MigrationException
MigrationException
public boolean schemaExists() throws MigrationException
MigrationException
public void createDatabase() throws MigrationException
createDatabase
MigrationException
- if any.public void databaseSetOwner() throws MigrationException
databaseSetUser
SQLException
- if any.MigrationException
public void vacuumDatabase(boolean full) throws MigrationException
vacuumDatabase
full
- a boolean.SQLException
- if any.MigrationException
public void updateIplike() throws MigrationException
updateIplike
Exception
- if any.MigrationException
public boolean isIpLikeUsable() throws MigrationException
isIpLikeUsable
MigrationException
public void dropExistingIpLike() throws MigrationException
MigrationException
public void setupPlPgsqlIplike() throws MigrationException
setupPlPgsqlIplike
Exception
- if any.MigrationException
public void dropDatabase() throws MigrationException
dropDatabase
SQLException
- if any.MigrationException
public void addTimescaleDBExtension() throws MigrationException
MigrationException
public void prepareDatabase() throws MigrationException
prepareDatabase
MigrationException
- if any.public void migrate(org.springframework.core.io.Resource changelog) throws MigrationException
migrate
changelog
- MigrationException
- if any.public static String getLiquibaseContexts()
public void setupDatabase(boolean updateDatabase, boolean vacuum, boolean fullVacuum, boolean iplike, boolean timescaleDB) throws MigrationException, Exception, IOException
MigrationException
Exception
IOException
public Collection<org.springframework.core.io.Resource> getLiquibaseChangelogs(boolean required) throws IOException, Exception
IOException
Exception
public String getContextClassLoaderUrls()
public static String getSystemClassLoaderUrls()
public static String getResourceLoaderClassLoaderUrls(org.springframework.core.io.ResourceLoader resourceLoader)
public static String getClassLoaderUrls(ClassLoader classLoader)
public void setApplicationContext(org.springframework.context.ApplicationContext context)
public org.springframework.context.ApplicationContext getApplicationContext()
Copyright © 2021. All rights reserved.