Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"tablePerHierarchy false" does not create foreign key constraints! #1076

Closed
3 of 4 tasks
aadrian opened this issue Mar 20, 2018 · 4 comments
Closed
3 of 4 tasks

"tablePerHierarchy false" does not create foreign key constraints! #1076

aadrian opened this issue Mar 20, 2018 · 4 comments

Comments

@aadrian
Copy link

aadrian commented Mar 20, 2018

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.

@zexxar
Copy link

zexxar commented Mar 21, 2018

I also encountered this problem. Please fix.

@ogast2
Copy link

ogast2 commented Mar 22, 2018

I had the same problem already with Grails 3.3.2 (https://grails.slack.com/archives/C07M0GTDE/p1519404068000330) - please fix this issue

@puneetbehl puneetbehl self-assigned this May 10, 2018
@puneetbehl puneetbehl removed their assignment Jul 10, 2018
@eprozium
Copy link

eprozium commented Aug 8, 2018

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.

@drennane
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants