add ldap columns to user table
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
2024-01-04 15:07:59 +11:00
parent 4e0e55473a
commit 2b331719b9

View File

@@ -36,6 +36,8 @@ const createUsers string = `
RoleId INTEGER, RoleId INTEGER,
UserName VARCHAR, UserName VARCHAR,
Password VARCHAR, Password VARCHAR,
LdapUser BOOLEAN,
LdapDN VARCHAR,
FOREIGN KEY (RoleId) REFERENCES roles(RoleId) FOREIGN KEY (RoleId) REFERENCES roles(RoleId)
); );
` `
@@ -177,6 +179,22 @@ func CreateTables() {
} }
} }
// Add the two LDAP columns to the users table if they weren't there
ldapUserCheck, _ := CheckColumnExists("users", "LdapUser")
if !ldapUserCheck {
log.Printf("CreateTables creating ldap columns in user table")
_, err := db.Exec("ALTER TABLE users ADD COLUMN LdapUser BOOLEAN;")
if err != nil {
log.Printf("Error altering users table to add LdapUser column : '%s'\n", err)
os.Exit(1)
}
_, err = db.Exec("ALTER TABLE users ADD COLUMN LdapDN VARCHAR;")
if err != nil {
log.Printf("Error altering users table to add LdapDN column : '%s'\n", err)
os.Exit(1)
}
}
} }
// Count the number of records in the sqlite database // Count the number of records in the sqlite database