Your Question
Trying to enhance the gorm-firebird driver from “github.com/flylink888/gorm-firebird”. Running the tests against firebird 3.0.9 I get (among other errors): default_value_test.go:25: Failed to migrate with default value.
The data in that test is defined as follows:
type Harumph struct {
...
Name2 string `gorm:"size:233;not null;default:'foo'"`
...
}
which creates this SQL:
NAME2 VARCHAR(233) NOT NULL DEFAULT 'foo'
Now, firebird wants the default clause before the NOT NULL, e.g.
NAME2 VARCHAR(233) DEFAULT 'foo' NOT NULL
Where can I change the SQL that is created?
The document you expected this should be explained
Expected answer
A pointer how/where I can change the generation of SQL, in this case the for a field in the CREATE TABLE statement.
Comment From: a631807682
You can implement CreateTable yourself.
https://github.com/go-gorm/gorm/blob/master/migrator.go#L64
Comment From: hhindriks
Thank you! Is there a similar interface where I can overwrite the generation of INSERT statements? FIrebird doesn't support more then one tupel to be inserted..
Comment From: a631807682
You can replace create callback, refer to this driver. https://github.com/go-gorm/clickhouse