I'm running AutoMigrate on this model but it is not working properly:

type BrandMemoryContent struct {
    gorm.Model

    Content string `gorm:"not null" json:"content"`

    // FKs
    BrandID uint   `gorm:"not null;index:idx_brand_memory_brand,unique;" json:"-"`
    Brand   *Brand `json:"-" gorm:"foreignKey:BrandID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`

    LastEditedBy sql.NullInt32 `json:"-"`
    User         *User         `json:"last_editor" gorm:"foreignKey:LastEditedBy;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`

    BrandMemoryID uint         `gorm:"not null;index:idx_brand_memory_brand,unique;" json:"-"`
    BrandMemory   *BrandMemory `json:"-" gorm:"foreignKey:BrandMemoryID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
}

The problem is that it does not add "ON UPDATE CASCADE" and "ON DELETE CASCADE" to brand_id FOREIGN KEY. For the other two foreign keys (brand_id and last_edited_by) it works properly.

All needed models are migrated before BrandMemoryContent, including BrandMemory.

Am I doing something wrong?

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking