Default values not present in the DB.
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
### Task List
- [x] Steps to reproduce provided
- [ ] Stacktrace (if present) provided
- [x] Example that reproduces the problem uploaded to Github
- [x] Full description of the issue provided (see below)
### 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
- **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
Contributor guide
Research direction
Start with the linked example's grails-app/domain/com/mycorp/fieldbugs1/TableOne.groovy and compare its generated ddl.sql with the schema-export behavior. Trace how UI default values are handled for DDL generation and dbCreate=validate; done means the DDL contains those defaults and validation reports a mismatch when the database does not.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100