Menu

#17 Drop tables order should be the reverse of create tables

open
nobody
DDL (7)
5
2003-07-10
2003-07-10
Terry
No

PROBLEM:

Because of FK constraints, the DROP TABLE statements
should be in the *reverse* order of the CREATE TABLE
statements in the DDL. Currently, there are in the same
order.

SOLUTION:

In the generate() method of DDL.java, replace the
following code:

for ( i=0, size=tableList.size() ; i<size ; i++ ){
SQLTable table = (SQLTable)tableList.elementAt( i );
gen.drop( table, out );
}

With:

for ( i=tableList.size()-1 ; i>=0; i-- ){
SQLTable table = (SQLTable)tableList.elementAt( i );
gen.drop( table, out );
}

I have tested this fix with MS SQL Server 2000. Hsqldb
doesn't care either way.

Discussion

MongoDB Logo MongoDB