Class HibernateAlterTableExecutor
java.lang.Object
com.atlassian.confluence.upgrade.ddl.HibernateAlterTableExecutor
- All Implemented Interfaces:
AlterTableExecutor
Executes all the various database-specific table altering commands.
PLEASE READ: Due to CONFDEV-7957 (and until HSQLDB addresses their concurrency issues), any upgrade tasks that composes this executor must be wrapped in a transaction proxy with REQUIRES_NEW propagation.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHibernateAlterTableExecutor
(HibernateDatabaseCapabilities databaseCapabilities, DdlExecutor ddlExecutor) -
Method Summary
Modifier and TypeMethodDescriptionvoid
alterTable
(String tableName, List<? extends AlterTableCommand> commands) Perform a set of table altering actions on a given table.createAddUniqueConstraintCommand
(String constraintName, String... columnNames) createAlterColumnNullChoiceCommand
(String columnName, String oldDataType, NullChoice nullChoice) createDropUniqueConstraintByColumnsCommand
(String... columnNames) Drop constraints by column names.createDropUniqueConstraintCommand
(String constraintName) createDropUniqueConstraintIfExistsCommand
(String constraintName) getAlterTableStatements
(String tableName, List<? extends AlterTableCommand> commands)
-
Field Details
-
POSTGRES_RELATION_ALREADY_EXISTS_SQLSTATE
- See Also:
-
MYSQL_RELATION_ALREADY_EXISTS_SQLSTATE
- See Also:
-
MYSQL_RELATION_ALREADY_EXISTS_ERRORCODE
public static final int MYSQL_RELATION_ALREADY_EXISTS_ERRORCODE- See Also:
-
SQLSERVER_INDEX_ALREADY_EXISTS_ERRORCODE
public static final int SQLSERVER_INDEX_ALREADY_EXISTS_ERRORCODE- See Also:
-
SQLSERVER_RELATION_ALREADY_EXISTS_ERRORCODE
public static final int SQLSERVER_RELATION_ALREADY_EXISTS_ERRORCODE- See Also:
-
HSQLDB_RELATION_ALREADY_EXISTS_SQLSTATE
- See Also:
-
HSQLDB_RELATION_ALREADY_EXISTS_ERRORCODE
public static final int HSQLDB_RELATION_ALREADY_EXISTS_ERRORCODE- See Also:
-
-
Constructor Details
-
HibernateAlterTableExecutor
public HibernateAlterTableExecutor(HibernateDatabaseCapabilities databaseCapabilities, DdlExecutor ddlExecutor) - Since:
- 7.13.17
-
-
Method Details
-
createAlterColumnNullChoiceCommand
public AlterColumnNullabilityCommand createAlterColumnNullChoiceCommand(String columnName, String oldDataType, NullChoice nullChoice) - Specified by:
createAlterColumnNullChoiceCommand
in interfaceAlterTableExecutor
-
createAddUniqueConstraintCommand
public AddUniqueConstraintCommand createAddUniqueConstraintCommand(String constraintName, String... columnNames) - Specified by:
createAddUniqueConstraintCommand
in interfaceAlterTableExecutor
-
createDropUniqueConstraintCommand
- Specified by:
createDropUniqueConstraintCommand
in interfaceAlterTableExecutor
-
createDropUniqueConstraintIfExistsCommand
- Specified by:
createDropUniqueConstraintIfExistsCommand
in interfaceAlterTableExecutor
-
createDropUniqueConstraintByColumnsCommand
public DropUniqueConstraintByColumnsCommand createDropUniqueConstraintByColumnsCommand(String... columnNames) Description copied from interface:AlterTableExecutor
Drop constraints by column names. This operation is presently only supported for Oracle.- Specified by:
createDropUniqueConstraintByColumnsCommand
in interfaceAlterTableExecutor
- Parameters:
columnNames
- The names of the columns that make up the unique constraint
-
alterTable
Description copied from interface:AlterTableExecutor
Perform a set of table altering actions on a given table. On some databases such as PostgreSQL this is combined into a single statement automatically. On other databases such as HSQLDB, each alter action is executed as a separate statement.- Specified by:
alterTable
in interfaceAlterTableExecutor
- Parameters:
tableName
- Name of the table to altercommands
- A collection of alter table actions to perform
-
getAlterTableStatements
public List<String> getAlterTableStatements(String tableName, List<? extends AlterTableCommand> commands) - Specified by:
getAlterTableStatements
in interfaceAlterTableExecutor
-