Maintaining the position of columns in Grails/GORM
- by firnnauriel
Is there a way to fix the position of the columns in a domain? I have this domain:
class SnbrActVector {
int nid
String term
double weight
static mapping = {
version false
id(generator: 'assigned')
}
static constraints = {
nid(blank:false)
term(blank:false)
weight(blank:false)
}
}
This is the schema of the table generated:
CREATE TABLE `fractor_grailsDEV`.`snbr_act_vector` (
`id` bigint(20) NOT NULL,
`weight` double NOT NULL,
`term` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`nid` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
It seems that the order of the columns were reversed. Is there a way to make it like this? (order is nid, term, weight)
CREATE TABLE `fractor_grailsDEV`.`snbr_act_vector` (
`id` bigint(20) NOT NULL,
`nid` int(11) NOT NULL,
`term` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`weight` double NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci