Your Question
autoIncrement 和 autoIncrementIncrement 好像没有效果.
autoIncrement and autoIncrementIncrement seems has no effect.
The document you expected this should be explained
https://gorm.io/docs/models.html#Fields-Tags
Expected answer
I want make two table's auto increment ID don't duplicate, one is auto increment start by 1, and offset is 2, another table start by 2, offset is 2. So that table 1's ID is 1,3,5,7..... And table 2's ID looks like 2,4,6,8....
I try this but it not work
type TestTableOne struct {
ID int `gorm:"autoIncrement:1;autoIncrementIncrement:2"`
}
type TestTableTwo struct {
ID int `gorm:"autoIncrement:2;autoIncrementIncrement:2"`
}
Comment From: kashif9798
same issue. tried every combination of autoIncrement and autoIncrementIncrement. nothing seems to work to define the offset for the auto incrementing column
Postgres DB
Comment From: lakkiy
@jinzhu
Comment From: wclssdn
这俩值是在migrate的时候使用的。。。 目前迁移的时候,也有bug,根本就不生效。。。 哎,自己动手丰衣足食吧~
Comment From: wclssdn
我本地尝试改了下,可以工作,参考:https://github.com/go-gorm/gorm/pull/5452
Comment From: li-jin-gou
already solve