diff --git a/vingo/database/db.go b/vingo/database/db.go index 2a169dd..157c7ae 100644 --- a/vingo/database/db.go +++ b/vingo/database/db.go @@ -24,31 +24,13 @@ func OpenDatabase(db_string string) { log.Fatal(err) } - err = new_db.AutoMigrate(&Settings{}) + err = new_db.AutoMigrate() if err != nil { log.Println("Error migrating database") log.Fatal(err) } - err = new_db.AutoMigrate(&User{}) - if err != nil { - log.Println("Error migrating database") - log.Fatal(err) - } - - err = new_db.AutoMigrate(&Card{}) - if err != nil { - log.Println("Error migrating database") - log.Fatal(err) - } - - err = new_db.AutoMigrate(&Scan{}) - if err != nil { - log.Println("Error migrating database") - log.Fatal(err) - } - - err = new_db.AutoMigrate(&Day{}) + err = new_db.AutoMigrate(&User{}, &Card{}, &Scan{}, &Day{}, &Settings{}, &Season{}) if err != nil { log.Println("Error migrating database") log.Fatal(err) diff --git a/vingo/database/users.go b/vingo/database/users.go index 441df16..123d93d 100644 --- a/vingo/database/users.go +++ b/vingo/database/users.go @@ -1,6 +1,8 @@ package database -import "time" +import ( + "time" +) func CreateUserIfNew(user_id int, username string) error { var user = &User{Username: username, Settings: Settings{ScanInOut: false, Leaderboard: true, Public: false}}