add constraint dropping when dropping index in case of unique
This commit is contained in:
parent
6012bc4c56
commit
60c03c429b
|
@ -86,9 +86,13 @@ public class DropIndexTask extends BaseTableTask {
|
|||
@Language("SQL") String findConstraintSql = "SELECT DISTINCT constraint_name FROM user_cons_columns WHERE constraint_name = ? AND table_name = ?";
|
||||
@Language("SQL") String dropConstraintSql = "ALTER TABLE " + getTableName() + " DROP CONSTRAINT ?";
|
||||
findAndDropConstraint(findConstraintSql, dropConstraintSql);
|
||||
|
||||
findConstraintSql = "SELECT DISTINCT constraint_name FROM all_constraints WHERE index_name = ? AND table_name = ?";
|
||||
findAndDropConstraint(findConstraintSql, dropConstraintSql);
|
||||
} else if (getDriverType() == DriverTypeEnum.MSSQL_2012) {
|
||||
// Legacy deletion for SQL Server unique indexes
|
||||
@Language("SQL") String findConstraintSql = "SELECT tc.CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS tc WHERE tc.CONSTRAINT_NAME = ? AND tc.TABLE_NAME = ?";
|
||||
@Language("SQL") String dropConstraintSql = "ALTER TABLE " + getTableName() + " DROP CONSTRAINT ?";
|
||||
findAndDropConstraint(findConstraintSql, dropConstraintSql);
|
||||
}
|
||||
|
||||
Set<String> indexNames = JdbcUtils.getIndexNames(getConnectionProperties(), getTableName());
|
||||
|
|
Loading…
Reference in New Issue