GORM Playground Link

https://github.com/go-gorm/playground/pull/471

Description

I don't know if this is a bug or an unsupported feature, I can't find the doc but I can see this feature in the test file.

I using DisableForeignKeyConstraintWhenMigrating:true mode and i want to AutoMigrate sharding table.

type Order struct {
    ID      int64 `gorm:"primarykey"`
    UserID  int64
    Product string
}

DB.Table("order_0").AutoMigrate(&Order{})
DB.Table("order_1").AutoMigrate(&Order{}) // success
....

it work If it is not associated with other models

type User struct {
    gorm.Model
    Name   string
    Orders []Order
}

type Order struct {
    ID      int64 `gorm:"primarykey"`
    UserID  int64
    Product string
}

DB.Table("order_0").AutoMigrate(&Order{})
DB.Table("order_1").AutoMigrate(&Order{}) // panic