Skip to content

Commit

Permalink
HHH-7472 - Introduce a "schema management" service
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed Aug 14, 2012
1 parent 392f08f commit 07973f2
Showing 1 changed file with 10 additions and 10 deletions.
Expand Up @@ -74,23 +74,23 @@ public void doDrop(Database database, boolean dropSchemas, Target... targets) th
}

for ( Table table : schema.getTables() ) {
if ( ! dialect.supportsUniqueConstraintInCreateAlterTable() ) {
for ( UniqueKey uniqueKey : table.getUniqueKeys() ) {
applySqlStrings( uniqueKey, targets, dialect, exportIdentifiers );
}
}

for ( Index index : table.getIndexes() ) {
applySqlStrings( index, targets, dialect, exportIdentifiers );
}
if ( dialect.dropConstraints() ) {
// we need to drop constraints prior to dropping table

if ( dialect.hasAlterTable() ) {
for ( ForeignKey foreignKey : table.getForeignKeys() ) {
// only add the foreign key if its target is a physical table
if ( Table.class.isInstance( foreignKey.getTargetTable() ) ) {
applySqlStrings( foreignKey, targets, dialect, exportIdentifiers );
}
}

for ( UniqueKey uniqueKey : table.getUniqueKeys() ) {
applySqlStrings( uniqueKey, targets, dialect, exportIdentifiers );
}

for ( Index index : table.getIndexes() ) {
applySqlStrings( index, targets, dialect, exportIdentifiers );
}
}

applySqlStrings( table, targets, dialect, exportIdentifiers );
Expand Down

0 comments on commit 07973f2

Please sign in to comment.