fix RoleId in secrets table
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -183,7 +183,7 @@ func GetSecrets(s *Secret, adminRole bool) ([]Secret, error) {
|
||||
} else if s.UserName != "" {
|
||||
rows, err = db.Queryx("SELECT * FROM secrets WHERE UserName LIKE ? AND SafeId = ?", s.UserName, s.SafeId)
|
||||
} else {
|
||||
rows, err = db.Queryx("SELECT * FROM secrets WHERE RoleId = ?", s.SafeId)
|
||||
rows, err = db.Queryx("SELECT * FROM secrets WHERE SafeId = ?", s.SafeId)
|
||||
//log.Printf("GetSecret no valid search options specified\n")
|
||||
//err = errors.New("no valid search options specified")
|
||||
//return secretResults, err
|
||||
|
@@ -301,6 +301,16 @@ func CreateTables() {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove RoleId column from secrets table
|
||||
secretsRoleIdCheck, _ := CheckColumnExists("secrets", "RoleId")
|
||||
if secretsRoleIdCheck {
|
||||
_, err := db.Exec("ALTER TABLE secrets DROP COLUMN RoleId;")
|
||||
if err != nil {
|
||||
log.Printf("Error altering secrets table to renmove RoleId column : '%s'\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Add SafeId column to secrets table
|
||||
safeIdCheck, _ := CheckColumnExists("secrets", "SafeId")
|
||||
if !safeIdCheck {
|
||||
|
Reference in New Issue
Block a user