My string columns are defaulting to 20 characters. All the documentation suggests the default is 255. How do I set that without changing each individual column. I am using Grails 3.3.8 and Postgresql 9.3.
class DbConnection {
String name
String platform
creates 20 character columns If I add a mapping:
static mapping = {
name sqlType: 'varchar(255)'
platform sqlType: 'varchar(255)'
url sqlType: 'varchar(255)'
}
I get the proper 255 characters, however, grails fails the string on validation:
Field error in object 'dop_etc.DbConnection' on field 'url': rejected value [localhost:5432/rbc48_fantasy]; codes [dop_etc.DbConnection.url.size.error.dop_etc.DbConnection.url,dop_etc.DbConnection.url.size.error.url,dop_etc.DbConnection.url.size.error.java.lang.String...
There seems to be a default size set somewhere and I can't seem to find it. Thanks for your responses.
Apologies, found the problem in some pasted code (in application.groovy)
Here's the helpful article: Overriding default `maxSize` in domain class