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 using bun migrations and have already run a migration like the following:
if _, err := db.NewCreateTable().
Model(&struct {
bun.BaseModel `bun:"table:<redacted>"`
ID int `bun:"id,pk,autoincrement"`
CreatedAt time.Time `bun:"created_at,type:datetime,notnull"`
UpdatedAt time.Time `bun:"updated_at,type:datetime,notnull"`
}{}).
IfNotExists().
Exec(ctx); err != nil {
return err
}
The migration has ran successfully and the migration table has already recorded that this group is complete. I now want to add a new column to the above table and add a foreign key constraint to it. I tried the following:
I'm using bun migrations and have already run a migration like the following:
The migration has ran successfully and the migration table has already recorded that this group is complete. I now want to add a new column to the above table and add a foreign key constraint to it. I tried the following:
But this just adds an
org_id
. How do I create a foreign key constraint out of it?The text was updated successfully, but these errors were encountered: