scouting: Fix timestamp issue during action submission
The newly deployed scouting app was giving users these kinds of
errors:
Received 500 Internal Server Error: "Failed to add action to
database: ERROR: null value in column "time_stamp" of relation
"actions" violates not-null constraint (SQLSTATE 23502)"
The issue was that the database was created with the
`Action.TimeStamp` field. This was the spelling from the action
submission patch I cherry-picked a long time ago. Later, as the action
submission patch made its way onto master, the spelling changed to
`Action.Timestamp`. This means that a database that was already
created cannot be used by both versions of the software.
Since the database already used the `TimeStamp` spelling, I am
changing the code here to match. For next year, we should settle on a
spelling and fix it.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I776724e740556ff8267d7a68be5111793b4574db
diff --git a/scouting/db/db.go b/scouting/db/db.go
index 1282638..b4d1bca 100644
--- a/scouting/db/db.go
+++ b/scouting/db/db.go
@@ -62,8 +62,9 @@
CompLevel string `gorm:"primaryKey"`
// This contains a serialized scouting.webserver.requests.ActionType flatbuffer.
CompletedAction []byte
- Timestamp int64 `gorm:"primaryKey"`
- CollectedBy string
+ // TODO(phil): Get all the spellings of "timestamp" to be the same.
+ TimeStamp int64 `gorm:"primaryKey"`
+ CollectedBy string
}
type NotesData struct {