public class TopiaMigrationServiceExecutor extends Object implements MigrationVersionResourceExecutor
MigrationVersionResourceExecutor with extra methods used by TopiaMigrationService.migrateVersion(TopiaMigrationServiceContext, Version).
This executor is pass to each version to migrate.
Created by tchemit on 06/05/2018.
| Modifier and Type | Field and Description |
|---|---|
protected String |
classifier |
protected String |
logPrefix |
protected Path |
scriptForVersion |
protected TopiaSqlDllSupport |
sqlDllSupport |
protected TopiaSqlSupport |
sqlSupport |
protected org.nuiton.version.Version |
version |
protected SqlScriptWriter |
writer |
| Modifier | Constructor and Description |
|---|---|
protected |
TopiaMigrationServiceExecutor(org.nuiton.version.Version version,
TopiaSqlSupport sqlSupport,
String classifier,
Path scriptsPath) |
protected final org.nuiton.version.Version version
protected final TopiaSqlSupport sqlSupport
protected final TopiaSqlDllSupport sqlDllSupport
protected final String classifier
protected final Path scriptForVersion
protected final SqlScriptWriter writer
protected final String logPrefix
protected TopiaMigrationServiceExecutor(org.nuiton.version.Version version,
TopiaSqlSupport sqlSupport,
String classifier,
Path scriptsPath)
public String getLogPrefix()
public Path getScriptForVersion()
public void writeSql(String sql)
writeSql in interface MigrationVersionResourceExecutorpublic void addScript(String rank, String prefix)
addScript in interface MigrationVersionResourceExecutorpublic <O> O findSingleResult(TopiaSqlQuery<O> query)
findSingleResult in interface MigrationVersionResourceExecutorpublic <O> List<O> findMultipleResult(TopiaSqlQuery<O> query)
findMultipleResult in interface MigrationVersionResourceExecutorpublic <O> Set<O> findMultipleResultAstSet(TopiaSqlQuery<O> query)
findMultipleResultAstSet in interface MigrationVersionResourceExecutorpublic void dropSchema(String schemaName)
dropSchema in interface MigrationVersionResourceExecutorpublic void dropTable(String schemaName, String tableName)
dropTable in interface MigrationVersionResourceExecutorpublic void doSqlWork(TopiaSqlWork sqlWork)
doSqlWork in interface MigrationVersionResourceExecutorpublic Set<String> getTopiaIds(String tableName)
getTopiaIds in interface MigrationVersionResourceExecutorpublic String getUniqueConstraintName(String tableName, String columnName)
getUniqueConstraintName in interface MigrationVersionResourceExecutorpublic String getFirstTableUniqueConstraintName(String tableName)
getFirstTableUniqueConstraintName in interface MigrationVersionResourceExecutorpublic Set<String> getConstraintNames(String tableName)
getConstraintNames in interface MigrationVersionResourceExecutorpublic Set<String> getForeignKeyConstraintNames(String tableName)
getForeignKeyConstraintNames in interface MigrationVersionResourceExecutorpublic String getForeignKeyConstraintName(String schemaName, String tableName, String columnName, boolean mustExists)
getForeignKeyConstraintName in interface MigrationVersionResourceExecutorpublic Set<String> getUniqueKeyConstraintNames(String tableName)
getUniqueKeyConstraintNames in interface MigrationVersionResourceExecutorpublic void removeFK(String tableName)
removeFK in interface MigrationVersionResourceExecutorpublic void removeFK(String schemaName, String tableName, String columnName)
removeFK in interface MigrationVersionResourceExecutorpublic void removeFKIfExists(String schemaName, String tableName, String columnName)
removeFKIfExists in interface MigrationVersionResourceExecutorpublic void removePKIfExists(String schemaName, String tableName)
removePKIfExists in interface MigrationVersionResourceExecutorpublic void removeUK(String tableName)
removeUK in interface MigrationVersionResourceExecutorpublic void executeForPG(Consumer<MigrationVersionResourceExecutor> consumer)
executeForPG in interface MigrationVersionResourceExecutorpublic void executeForH2(Consumer<MigrationVersionResourceExecutor> consumer)
executeForH2 in interface MigrationVersionResourceExecutorpublic long flush()
throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionprotected void loadScript(org.nuiton.version.Version version,
String rank,
String prefix)
protected URL getScriptLocation(org.nuiton.version.Version version, String rank, String prefix, String classifier)
protected String getScriptPath(org.nuiton.version.Version version, String rank, String prefix, String scriptSuffix)
protected boolean isH2()
protected boolean isPG()
Copyright © 2018 Ultreia.io. All rights reserved.