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

For Enum field in domain class, maxSize cannot be applied in migration #1434

Open
4 tasks
keitaroemotion opened this issue Feb 6, 2021 · 0 comments
Open
4 tasks

Comments

@keitaroemotion
Copy link

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

  1. make domain class with enum field.
  2. make constraints for the enum field with maxSize: 100
  3. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant