"tablePerHierarchy false" does not create foreign key constraints!
Closed this issue · 4 comments
Task List
- Steps to reproduce provided
- Stacktrace (if present) provided
- Example that reproduces the problem uploaded to Github
- Full description of the issue provided (see below)
Steps to Reproduce
Using:
static mapping {
tablePerHierarchy false
}
With schema-export
should generate FK Constraints between parent and child entities, but this is not the case with Grails 3.3.x anymore. See https://github.com/aadrian/fieldbugs1/blob/master/h2_ddl.sql : there's no FK constraint between table_child
, table_child_two
and the table_parent
like it was with Grails 2.2.x :(
(The corresponding entities: TableParent.groovy, TableChild, TableChildTwo.groovy )
Expected Behaviour
Same behavior as in Grails 2.x:
schema-export
should generate FK constraints between child and parent entities.- when using
dbCreate=validate
an error/warning message should be displayed if the DB is not in sync with the model.
Actual Behaviour
- FK constraints are not generated with
schema-export
- validation error/warning for the missing FK is not displayed when mode is
dbCreate=validate
Environment Information
- Operating System: OSX, Linux, Win 7,8,10
- GORM Version: 6.1.9
- Grails Version (if using Grails): 3.3.3
- JDK Version: 1.8.0_162
Example Application
https://github.com/aadrian/fieldbugs1
Thank you.
I also encountered this problem. Please fix.
I had the same problem already with Grails 3.3.2 (https://grails.slack.com/archives/C07M0GTDE/p1519404068000330) - please fix this issue
This issue restricts the use of Grails 3 very badly :( .
Many real world use cases require modeling of hierarchies, and dbCreate=validate
is indispensible to make sure no new bugs are slip in.
Also find this to be a very significant oversight. Would be interested to know if this is on any short to medium term roadmap to get resolved?