Pretty straight-forward:
type UserModel struct {
ID int64 `sql:",unique,notnull"`
Email string
Name string
Age sql.NullInt64
}
err := db.CreateTable(&UserModel{}, &orm.CreateTableOptions{})
if err != nil {
log.Errorf("Could not create table: %v", err)
}
Log output:
15:47:42.938 main â–¶ ERRO 002 Could not create table: ERROR #42704 type "struct" does not exist (addr="[::1]:5432")
It then succeeds if I remove the field Age.
As you can imagine, being able to create tables from models with nullable fields is pretty important.
Should be fixed in v5.2.7
Most helpful comment
Should be fixed in v5.2.7