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

This commit is contained in:
2024-01-19 11:01:38 +11:00
parent 8799f0f796
commit 1b5a2e89dd

View File

@@ -85,9 +85,9 @@ const createAudit string = `
AuditId INTEGER PRIMARY KEY AUTOINCREMENT, AuditId INTEGER PRIMARY KEY AUTOINCREMENT,
UserId INTEGER DEFAULT 0, UserId INTEGER DEFAULT 0,
SecretId INTEGER DEFAULT 0, SecretId INTEGER DEFAULT 0,
EventText VARCHAR, EventText VARCHAR DEFAULT '',
IpAddress VARCHAR, IpAddress VARCHAR DEFAULT '',
EventTime datetime EventTime datetime DEFAULT (datetime('1970-01-01 00:00:00'))
); );
` `
@@ -405,6 +405,11 @@ func CreateTables() {
log.Printf("Error altering audit table to add IpAddress column : '%s'\n", err) log.Printf("Error altering audit table to add IpAddress column : '%s'\n", err)
os.Exit(1) os.Exit(1)
} }
if _, err = db.Exec("UPDATE audit SET IpAddress = '' WHERE IpAddress is null;"); err != nil {
log.Printf("Error setting IpAddress of existing audit records : '%s'", err)
os.Exit(1)
}
} }
} }