add last updated tracking for secrets
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-16 16:21:41 +11:00
parent 498dd9a8c3
commit b278a3c7d8
3 changed files with 48 additions and 23 deletions

View File

@@ -68,6 +68,7 @@ const createSecrets string = `
DeviceCategory VARCHAR,
UserName VARCHAR,
Secret VARCHAR,
LastUpdated datetime,
FOREIGN KEY (SafeId) REFERENCES safes(SafeId)
);
`
@@ -380,6 +381,16 @@ func CreateTables() {
}
}
secretsLastUpdatedCheck, _ := CheckColumnExists("secrets", "LastUpdated")
if !secretsLastUpdatedCheck {
// Add the column for LastUpdated in the secrets table
_, err := db.Exec("ALTER TABLE secrets ADD COLUMN LastUpdated datetime;")
if err != nil {
log.Printf("Error altering secrets table to add LastUpdated column : '%s'\n", err)
os.Exit(1)
}
}
/*
// Database updates added after initial version released
ldapCheck, _ := CheckColumnExists("roles", "LdapGroup")