Skip to main content
Jump to: navigation, search


Revision as of 08:22, 17 January 2012 by (Talk | contribs) (Constraints)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


What about foreign key and unique constraints? If a foreign is the column that is added, will the foreign key constraint also be added? What if the column is unique, will a unique constraint be defined. Also indexes. 14:27, 16 January 2012 (UTC)

It would be nice to also have an option to use the JDBC meta-data to drop constraints to allow tables to be dropped/replaced if the previous schema was different. 14:27, 16 January 2012 (UTC)

Unique + not-null constraints are added during field creation, just as they are during table creation. Foreign key constraints are handled the same as they are for DDL create - all fk constraints are added after the table alter/create process is run. There is no mechanism to see if a constraint has already been added, so all constraints are added, just like in create DDL. Sequences are also either created or ignored. Indexes are the product of postCreateObject on the TableDefinition which is only called when the table is first created. As looking for existing database objects outside of the table is outside the scope of this feature for the time being, they should be looked at being added/handled the same way as constraints currently are instead, otherwise new indexes cannot get added. 17:54, 16 January 2012 (UTC)

Removed Columns

Why is adding columns supported but not removing? Removing should also be supported as this feature will primarily be used by users during development to keep their database in synch with their model. If we are worried about drop unmapped columns used by other applications, then the option that only adds columns should not be call "create-or-alter-tables" as when we add support for removal it will not be able to use this name. "create-or-extend-tables" perhaps, and reserve "create-or-alter-tables" for the option that removes columns. 13:22, 17 January 2012 (UTC)

Back to the top