Update README for AddForeignKey example

This commit is contained in:
Jinzhu 2015-08-01 11:28:31 +08:00
parent 393d8a3a52
commit 85a682e820
1 changed files with 1 additions and 1 deletions

View File

@ -1126,7 +1126,7 @@ type Product struct {
// 2nd param : destination table(id) // 2nd param : destination table(id)
// 3rd param : ONDELETE // 3rd param : ONDELETE
// 4th param : ONUPDATE // 4th param : ONUPDATE
db.Model(&User{}).AddForeignKey("role_id", "roles", "CASCADE", "RESTRICT") db.Model(&User{}).AddForeignKey("city_id", "cities(id)", "RESTRICT", "RESTRICT")
// Add index // Add index
db.Model(&User{}).AddIndex("idx_user_name", "name") db.Model(&User{}).AddIndex("idx_user_name", "name")