Open
Description
GORM Playground Link
https://github.com/efiShtain/gorm-playground
Description
I'm trying to create a self referencing table where my foreign key points to a unique index which is not the primary key
I suspect that the migrator tries to create the index after the table creation, but the foreign key constraint is created when the table is created, this order of execution cause the issue
I've tried manually changing CreateIndexAfterCreateTable to false in the migrator, but it broke everything, and since it is hard coded to true, I assume there is a good reason for it
Adding the go struct here
type SelfReferencing struct {
Name string `gorm:"uniqueIndex;not null"`
OriginalName *string
Original *SelfReferencing `gorm:"references:Name"`
}
Metadata
Metadata
Assignees
Labels
No labels