Skip to content

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

@aadrian

Description

@aadrian

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions