You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
The text was updated successfully, but these errors were encountered: