update test

This commit is contained in:
Jinzhu 2014-03-26 11:02:17 +08:00
parent 663c06cfb1
commit 22cf9719bf
1 changed files with 5 additions and 0 deletions

View File

@ -169,6 +169,7 @@ func init() {
db.Exec("drop table addresses") db.Exec("drop table addresses")
db.Exec("drop table credit_cards") db.Exec("drop table credit_cards")
db.Exec("drop table roles") db.Exec("drop table roles")
db.Exec("drop table companies")
if err = db.CreateTable(&User{}).Error; err != nil { if err = db.CreateTable(&User{}).Error; err != nil {
panic(fmt.Sprintf("No error should happen when create table, but got %+v", err)) panic(fmt.Sprintf("No error should happen when create table, but got %+v", err))
@ -194,6 +195,10 @@ func init() {
panic(fmt.Sprintf("No error should happen when create table, but got %+v", err)) panic(fmt.Sprintf("No error should happen when create table, but got %+v", err))
} }
if err = db.AutoMigrate(Role{}).Error; err != nil {
panic(fmt.Sprintf("No error should happen when create table, but got %+v", err))
}
var shortForm = "2006-01-02 15:04:05" var shortForm = "2006-01-02 15:04:05"
t1, _ = time.Parse(shortForm, "2000-10-27 12:02:40") t1, _ = time.Parse(shortForm, "2000-10-27 12:02:40")
t2, _ = time.Parse(shortForm, "2002-01-01 00:00:00") t2, _ = time.Parse(shortForm, "2002-01-01 00:00:00")