castorp
Joined: 2008-03-06 13:38:06
Messages: 129
Offline
|
Hi,
I noticed that the generated DDL when comparing data models (at least for Oracle and Postgres) is a bit "complicated".
When a table (or column) is dropped, the DDL first contains drop statements for any related constraint. While that is technically correct and is probably needed for e.g. SQL Server or MySQL, Oracle and Postgres offer a CONSTRAINT option when dropping objects.
The resulting DDL script would be a lot smaller if the tables are dropped right at the beginning using "DROP TABLE the_table CASCADE" (Postgres) or "DROP TABLE the_table CASCADE CONSTRAINTS" (for Oracle).
Then all ALTER TABLE ... DROP CONSTRAINT for that table could be removed from the script, making it a bit more concise.
The same is true for dropping columns (simply add the CASCADE keyword and "forget" about any constraint to that column)
Regards
Thomas
|