grails / grails-data-mapping

GORM - Groovy Object Mapping
http://gorm.grails.org/
218 stars 198 forks source link

Default values not present in the DB. #1074

Open aadrian opened 6 years ago

aadrian commented 6 years ago

Task List

Steps to Reproduce

Default values used by the UI should be propagated to the DB too (for schema-export or direct use):

https://github.com/aadrian/fieldbugs1/blob/master/grails-app/domain/com/mycorp/fieldbugs1/TableOne.groovy#L9 and https://github.com/aadrian/fieldbugs1/blob/master/grails-app/domain/com/mycorp/fieldbugs1/TableOne.groovy#L10 are not present in the generated DDL https://github.com/aadrian/fieldbugs1/blob/master/ddl.sql

Expected Behaviour

DDL should contain the default values the UI is using, and if the DB does not, and dbCreate=validate than a warning/error should be displayed (like for other mapping differences).

Actual Behaviour

UI Default values are being ignored.

Environment Information

Example Application

https://github.com/aadrian/fieldbugs1

Thank you

zexxar commented 6 years ago

I also experienced this problem.