So I've finally introduced codenarc
into my project's build process and I'm getting the following warning - GrailsDomainReservedSqlKeywordName
.
The problem is that I have quite a few of these warnings, namely because I've named quite a few domain fields as data
. For example
class FormData {
Long data
static constraints = {
data nullable: true
}
...
The effect of this according to codenarc
is
Naming a domain class (or its field) with such a keyword causes SQL schema creation errors and/or redundant table/column name mappings.
My question is: Should I now rename all my data
properties and if so, how best to do it (perhaps using database migration)?
I'm just wondering why the Grails documentation did not warn against using these reserved keywords. Perhaps they should.