HHH-12271 - SchemaDropperImpl does not drop constraints with IF EXISTS
This commit is contained in:
parent
e92f350e22
commit
6bf2869355
|
@ -145,8 +145,21 @@ public class StandardForeignKeyExporter implements Exporter<ForeignKey> {
|
|||
dialect
|
||||
);
|
||||
return new String[] {
|
||||
dialect.getAlterTableString( sourceTableName )
|
||||
+ dialect.getDropForeignKeyString() + foreignKey.getName()
|
||||
getSqlDropStrings( sourceTableName, foreignKey, dialect )
|
||||
};
|
||||
}
|
||||
|
||||
private String getSqlDropStrings(String tableName, ForeignKey foreignKey, Dialect dialect) {
|
||||
final StringBuilder buf = new StringBuilder( dialect.getAlterTableString( tableName ) );
|
||||
buf.append( dialect.getDropForeignKeyString() );
|
||||
if ( dialect.supportsIfExistsBeforeConstraintName() ) {
|
||||
buf.append( "if exists " );
|
||||
}
|
||||
buf.append( dialect.quote( foreignKey.getName() ) );
|
||||
if ( dialect.supportsIfExistsAfterConstraintName() ) {
|
||||
buf.append( " if exists" );
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue