mirkosertic / MogwaiERDesignerNG

Java 2D & 3D visual entity relationship design & modeling (ERD,SQL) for Oracle,MSSQL,Postgres and MySQL
GNU General Public License v3.0
157 stars 73 forks source link

Incomplete database (DDL Execute) on erroneous database model #52

Open vaxorcist opened 5 years ago

vaxorcist commented 5 years ago

If you have an error in your database model (e.g. incompatible data types on primary and foreign key) and you execute the generated DDL SQL script, the resulting database will be incomplete.

The same problem exists with migration scripts for database updates ("Current db changes")

I suggest enclosing generated scripts in a Transaction, so that you will have either a complete action or nothing at all.

mirkosertic commented 5 years ago

This is indeed a great idea! Of course, this depends on the chosen database dialect. Not all supported databases support transactional DDL. IMHO PostgreSQL is the only one, so the transaction should only be created by this dialect.