Change CreatedAt and UpdatedAt to type Time and update migrations.go accordingly
This commit is contained in:
parent
2b46385126
commit
89d1b96400
@ -3,6 +3,7 @@ package models
|
||||
import (
|
||||
"GoWeb/app"
|
||||
"GoWeb/database"
|
||||
"time"
|
||||
)
|
||||
|
||||
// RunAllMigrations defines the structs that should be represented in the database
|
||||
@ -13,9 +14,13 @@ func RunAllMigrations(app *app.App) error {
|
||||
Username: "migrate",
|
||||
Password: "migrate",
|
||||
AuthToken: "migrate",
|
||||
CreatedAt: "2021-01-01 00:00:00",
|
||||
UpdatedAt: "2021-01-01 00:00:00",
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
err := database.Migrate(app, user)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return database.Migrate(app, user)
|
||||
return nil
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ type User struct {
|
||||
Username string
|
||||
Password string
|
||||
AuthToken string
|
||||
CreatedAt string
|
||||
UpdatedAt string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
// GetCurrentUser finds the currently logged-in user by session cookie
|
||||
|
Loading…
Reference in New Issue
Block a user