com.atlassian.confluence.upgrade.ddl
Class HibernateAlterTableExecutor

java.lang.Object
  extended by com.atlassian.confluence.upgrade.ddl.HibernateAlterTableExecutor
All Implemented Interfaces:
AlterTableExecutor

public class HibernateAlterTableExecutor
extends java.lang.Object
implements 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
static int HSQLDB_RELATION_ALREADY_EXISTS_ERRORCODE
           
static java.lang.String HSQLDB_RELATION_ALREADY_EXISTS_SQLSTATE
           
static int MYSQL_RELATION_ALREADY_EXISTS_ERRORCODE
           
static java.lang.String MYSQL_RELATION_ALREADY_EXISTS_SQLSTATE
           
static java.lang.String POSTGRES_RELATION_ALREADY_EXISTS_SQLSTATE
           
static int SQLSERVER_INDEX_ALREADY_EXISTS_ERRORCODE
           
static int SQLSERVER_RELATION_ALREADY_EXISTS_ERRORCODE
           
 
Constructor Summary
HibernateAlterTableExecutor(ConfluenceHibernateConfig hibernateConfig, DdlExecutor ddlExecutor)
           
 
Method Summary
 void alterTable(java.lang.String tableName, java.util.List<? extends AlterTableCommand> commands)
          Perform a set of table altering actions on a given table.
 AddUniqueConstraintCommand createAddUniqueConstraintCommand(java.lang.String constraintName, java.lang.String... columnNames)
           
 AlterColumnNullabilityCommand createAlterColumnNullChoiceCommand(java.lang.String columnName, java.lang.String oldDataType, NullChoice nullChoice)
           
 DropUniqueConstraintCommand createDropUniqueConstraintCommand(java.lang.String constraintName)
           
 java.util.List<java.lang.String> getAlterTableStatements(java.lang.String tableName, java.util.List<? extends AlterTableCommand> commands)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POSTGRES_RELATION_ALREADY_EXISTS_SQLSTATE

public static final java.lang.String POSTGRES_RELATION_ALREADY_EXISTS_SQLSTATE
See Also:
Constant Field Values

MYSQL_RELATION_ALREADY_EXISTS_SQLSTATE

public static final java.lang.String MYSQL_RELATION_ALREADY_EXISTS_SQLSTATE
See Also:
Constant Field Values

MYSQL_RELATION_ALREADY_EXISTS_ERRORCODE

public static final int MYSQL_RELATION_ALREADY_EXISTS_ERRORCODE
See Also:
Constant Field Values

SQLSERVER_INDEX_ALREADY_EXISTS_ERRORCODE

public static final int SQLSERVER_INDEX_ALREADY_EXISTS_ERRORCODE
See Also:
Constant Field Values

SQLSERVER_RELATION_ALREADY_EXISTS_ERRORCODE

public static final int SQLSERVER_RELATION_ALREADY_EXISTS_ERRORCODE
See Also:
Constant Field Values

HSQLDB_RELATION_ALREADY_EXISTS_SQLSTATE

public static final java.lang.String HSQLDB_RELATION_ALREADY_EXISTS_SQLSTATE
See Also:
Constant Field Values

HSQLDB_RELATION_ALREADY_EXISTS_ERRORCODE

public static final int HSQLDB_RELATION_ALREADY_EXISTS_ERRORCODE
See Also:
Constant Field Values
Constructor Detail

HibernateAlterTableExecutor

public HibernateAlterTableExecutor(ConfluenceHibernateConfig hibernateConfig,
                                   DdlExecutor ddlExecutor)
Method Detail

createAlterColumnNullChoiceCommand

public AlterColumnNullabilityCommand createAlterColumnNullChoiceCommand(java.lang.String columnName,
                                                                        java.lang.String oldDataType,
                                                                        NullChoice nullChoice)
Specified by:
createAlterColumnNullChoiceCommand in interface AlterTableExecutor

createAddUniqueConstraintCommand

public AddUniqueConstraintCommand createAddUniqueConstraintCommand(java.lang.String constraintName,
                                                                   java.lang.String... columnNames)
Specified by:
createAddUniqueConstraintCommand in interface AlterTableExecutor

createDropUniqueConstraintCommand

public DropUniqueConstraintCommand createDropUniqueConstraintCommand(java.lang.String constraintName)
Specified by:
createDropUniqueConstraintCommand in interface AlterTableExecutor

alterTable

public void alterTable(java.lang.String tableName,
                       java.util.List<? extends AlterTableCommand> commands)
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 interface AlterTableExecutor
Parameters:
tableName - Name of the table to alter
commands - A collection of alter table actions to perform

getAlterTableStatements

public java.util.List<java.lang.String> getAlterTableStatements(java.lang.String tableName,
                                                                java.util.List<? extends AlterTableCommand> commands)
Specified by:
getAlterTableStatements in interface AlterTableExecutor


Copyright © 2003-2014 Atlassian. All Rights Reserved.