Postgres外键上的删除约束

Been following the guide on http://gorm.io/docs/belongs_to.html trying to get simple foreign keys setup, however, I can't find any info on using ON CASCADE or ON DELETE.

On http://doc.gorm.io/database.html#migration under the Add Foreign Key section it does make use of ON DELETE and ON CASCADE, however when I use this method when inserting I get a fk constraint error.

I'm looking for advice on using the first method ,gorm:"foreignkey:UserRefer", to also specify ON DELETE or ON CASCADE. Any suggestions?

EDIT #1: To show what I mean by error, I'll use this as an example:

Note.go:

type Note struct {
  NoteId              int       `gorm:"primary_key;AUTO_INCREMENT"`
  RecipientId         int       `gorm:"index"`
  Content             string    `gorm:"not null"`
  CreatedAt           time.Time `gorm:"not null"`
  UpdatedAt           time.Time `gorm:"not null"`
}

User.go

type User struct {
  UserId              int       `gorm:"primary_key;AUTO_INCREMENT"`
  Username            string    `gorm:"not null;unique"`
  Email               string    `gorm:"not null;unique"`
  Notes               []Note
  CreatedAt           time.Time `gorm:"not null"`
  UpdatedAt           time.Time `gorm:"not null"`
}

database.go

db.AutoMigrate(&models.User{}, &models.Note{})
db.Model(&models.Note{}).AddForeignKey("recipient_id", "users(user_id)", "RESTRICT", "RESTRICT")

user := models.User{Username:"test", Email:"test@gmail.com"}
note := models.Note{RecipientId:user.UserId, Content:"test"}

db.Create(&user)
db.Create(&note)

When the above code is placed in its proper functions, this error is thrown:

(pq: insert or update on table "notes" violates foreign key constraint "notes_recipient_id_users_user_id_foreign")