Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Talk:EclipseLink/DesignDocs/368365"

(New page: == Constraints == 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, wil...)
 
Line 6: Line 6:
 
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.
 
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.
 
:[[User:James.sutherland.oracle.com|James.sutherland.oracle.com]] 14:27, 16 January 2012 (UTC)
 
:[[User:James.sutherland.oracle.com|James.sutherland.oracle.com]] 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. 
 +
--[[User:Christopher.delahunt.oracle.com|Christopher.delahunt.oracle.com]] 17:54, 16 January 2012 (UTC)

Revision as of 13:54, 16 January 2012

Constraints

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.

James.sutherland.oracle.com 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.

James.sutherland.oracle.com 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. --Christopher.delahunt.oracle.com 17:54, 16 January 2012 (UTC)

Back to the top