We're using gorm and I'd like to be able to specify database specific annotations. For convenience, in development/test we use an sqlite3 database, then MySQL in production.
Unfortunately sqlite3 doesn't accept CHARACTER SET
and COLLATE
keywords. Which means that the following breaks:
type User struct {
Name string `gorm:"primary_key;type:varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci"`
}
Has anyone found a work around for this? I'd rather not use mysql in test and I'd also rather not manually manage the columns.