Class SchemaServiceImpl
java.lang.Object
ch.tocco.nice2.dbrefactoring.impl.SchemaServiceImpl
- All Implemented Interfaces:
SchemaService
-
Constructor Summary
ConstructorDescriptionSchemaServiceImpl
(ChangelogService changelogService, DataSource dataSource, RunEnvironmentService runEnvironmentService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
createDatabaseSchemaDDL
(ChangelogType type, InstallParameters params, @Nullable String contexts, Writer out) Using the schema database changelog of all modules, this will create the SQL DDL statements needed to update the current database, while "current database" is the end of the connection obtained from the default data source.void
createDatabaseSchemaDDL
(File changelog, InstallParameters params, @Nullable String contexts, Writer out) Generates SQL DDL statements for the given changelog file.liquibase.Liquibase
createLiquibase
(Connection connection, File changelog, boolean ignoreErrors, ProgressLogger logger) void
setCustomChanges
(List<CustomChangeContribution> classes) void
setRemoveChangeLogLock
(boolean removeChangeLogLock) void
updateDatabaseSchema
(ChangelogType type, InstallParameters params, @Nullable String contexts) Runs the consolidated schema changelog of all current modules against the database of the default datasource.void
updateDatabaseSchema
(File changelog, InstallParameters params, @Nullable String contexts) Updates the database at the specified connection with SQL statements obtained from the given changelog file.void
updateDatabaseSchema
(liquibase.Liquibase liquibase, InstallParameters params, @Nullable String contexts)
-
Constructor Details
-
SchemaServiceImpl
public SchemaServiceImpl(ChangelogService changelogService, DataSource dataSource, RunEnvironmentService runEnvironmentService)
-
-
Method Details
-
setCustomChanges
-
createDatabaseSchemaDDL
public void createDatabaseSchemaDDL(ChangelogType type, InstallParameters params, @Nullable @Nullable String contexts, Writer out) throws DbRefactoringException Description copied from interface:SchemaService
Using the schema database changelog of all modules, this will create the SQL DDL statements needed to update the current database, while "current database" is the end of the connection obtained from the default data source.
If the current database is empty, the script will create the whole schema from scratch, otherwise it tries to perform an upgrade to current state.
The SQL statements are written to the specified writer.
- Specified by:
createDatabaseSchemaDDL
in interfaceSchemaService
- Parameters:
type
- the changelog type- Throws:
DbRefactoringException
-
createDatabaseSchemaDDL
public void createDatabaseSchemaDDL(File changelog, InstallParameters params, @Nullable @Nullable String contexts, Writer out) throws DbRefactoringException Description copied from interface:SchemaService
Generates SQL DDL statements for the given changelog file.- Specified by:
createDatabaseSchemaDDL
in interfaceSchemaService
- Throws:
DbRefactoringException
-
updateDatabaseSchema
public void updateDatabaseSchema(ChangelogType type, InstallParameters params, @Nullable @Nullable String contexts) throws DbRefactoringException Description copied from interface:SchemaService
Runs the consolidated schema changelog of all current modules against the database of the default datasource.- Specified by:
updateDatabaseSchema
in interfaceSchemaService
- Parameters:
type
- the changelog type- Throws:
DbRefactoringException
-
updateDatabaseSchema
public void updateDatabaseSchema(File changelog, InstallParameters params, @Nullable @Nullable String contexts) throws DbRefactoringException Description copied from interface:SchemaService
Updates the database at the specified connection with SQL statements obtained from the given changelog file.- Specified by:
updateDatabaseSchema
in interfaceSchemaService
- Throws:
DbRefactoringException
-
updateDatabaseSchema
public void updateDatabaseSchema(liquibase.Liquibase liquibase, InstallParameters params, @Nullable @Nullable String contexts) throws DbRefactoringException - Specified by:
updateDatabaseSchema
in interfaceSchemaService
- Throws:
DbRefactoringException
-
createLiquibase
public liquibase.Liquibase createLiquibase(Connection connection, File changelog, boolean ignoreErrors, ProgressLogger logger) throws liquibase.exception.LiquibaseException - Specified by:
createLiquibase
in interfaceSchemaService
- Throws:
liquibase.exception.LiquibaseException
-
setRemoveChangeLogLock
@Value("${nice2.dbrefactoring.removeChangeLogLock}") public void setRemoveChangeLogLock(boolean removeChangeLogLock)
-