grails-data-mapping
grails-data-mapping copied to clipboard
For Enum field in domain class, maxSize cannot be applied in migration
I am now trying to make migration in Grails, and here is my domain class:
class SomeDomain {
String stringField
EnumClass enumField
static constraints = {
stringField nullable: true, maxSize: 100
enumField nullable: true, maxSize: 100
}
}
then if I auto generated diff groovy file,
It reflects the stringField's maxSize(100), but for enumField there are no constraints reflected such that it is of maxSize(255).
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
- make domain class with enum field.
- make constraints for the enum field with maxSize: 100
- auto generate migration file according to 2. then you see maxSize(100) is not applied and its size is VARVHAR(255). (mySQL5.6)
Expected Behaviour
After the migration, the fields constraints should be 100.
Actual Behaviour
the fields constraints are size of 255
Environment Information
- Operating System: Amazon linux
- GORM Version: TODO
- Grails Version (if using Grails): | Grails Version: 3.2.13 | Groovy Version: 2.4.15 | JVM Version: 1.8.0_272 openjdk version "1.8.0_272" OpenJDK Runtime Environment (build 1.8.0_272-b10) OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode)
Example Application
- TODO: link to github repository with example that reproduces the issue