Add auto migration

This commit is contained in:
Jinzhu 2015-06-01 11:17:51 +08:00
parent 331d8ceabd
commit 58f379b098
1 changed files with 1 additions and 0 deletions

View File

@ -66,6 +66,7 @@ func TestStringPrimaryKey(t *testing.T) {
ID string `gorm:"primary_key"` ID string `gorm:"primary_key"`
Name string Name string
} }
DB.AutoMigrate(&UUIDStruct{})
data := UUIDStruct{ID: "uuid", Name: "hello"} data := UUIDStruct{ID: "uuid", Name: "hello"}
if err := DB.Save(&data).Error; err != nil || data.ID != "uuid" { if err := DB.Save(&data).Error; err != nil || data.ID != "uuid" {