Hi,
In my Grails app I have a domain class that has a property
SearchPrivacy searchPrivacy = SearchPrivacy.PUBLIC
where SearchPrivacy is an enum
enum SearchPrivacy {
PRIVATE('pr'), PUBLIC('pu');
final String id
SearchPrivacy(String id) {
this.id = id
}
static getEnumFromId(String id) {
values().find {it.id == id}
}
}
according to the Grails docs, the mapped database column will store either pr
or pu
- the value of the id
property. However, there doesn't seem to be a way to reduce the max length of the DB column. I've tried adding both of the following
static constrtaints = {
searchPrivacy(size: 2..2, maxSize: 2)
}
But in the generated schema the column is still varchar(255)
Thanks, Don