Change CreatedAt and UpdatedAt to type Time and update migrations.go accordingly

This commit is contained in:
Maximilian 2023-02-17 18:55:27 -06:00
parent 2b46385126
commit 89d1b96400
2 changed files with 10 additions and 5 deletions

View File

@ -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
}

View File

@ -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