fix column name
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-15 10:55:57 +11:00
parent 95125b691d
commit db63b89c61
3 changed files with 5 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ type Audit struct {
UserId int `db:"UserId" json:"userId"` UserId int `db:"UserId" json:"userId"`
SecretId int `db:"SecretId" json:"secretId"` SecretId int `db:"SecretId" json:"secretId"`
EventText string `db:"EventText" json:"eventText"` EventText string `db:"EventText" json:"eventText"`
Timestamp time.Time `db:"Timestamp" json:"Timestamp"` EventTime time.Time `db:"EventTime" json:"eventTime"`
} }
// AuditAdd adds a new audit record to the database // AuditAdd adds a new audit record to the database
@@ -19,11 +19,11 @@ func (a *Audit) AuditAdd() (*Audit, error) {
var err error var err error
// Populate timestamp field if not already set // Populate timestamp field if not already set
if a.Timestamp.IsZero() { if a.EventTime.IsZero() {
a.Timestamp = time.Now() a.EventTime = time.Now()
} }
result, err := db.NamedExec(("INSERT INTO audit (UserId, SecretId, EventText, Timestamp) VALUES (:UserId, :SecretId, :EventText, :Timestamp);"), a) result, err := db.NamedExec(("INSERT INTO audit (UserId, SecretId, EventText, EventTime) VALUES (:UserId, :SecretId, :EventText, :EventTime);"), a)
if err != nil { if err != nil {
log.Printf("AuditAdd error executing sql record : '%s'\n", err) log.Printf("AuditAdd error executing sql record : '%s'\n", err)

View File

@@ -84,7 +84,7 @@ const createAudit string = `
UserId INTEGER DEFAULT 0, UserId INTEGER DEFAULT 0,
SecretId INTEGER DEFAULT 0, SecretId INTEGER DEFAULT 0,
EventText VARCHAR, EventText VARCHAR,
Timestamp datetime EventTime datetime
); );
` `

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 80 KiB