Fix inconsistencies between int and bool in db

This commit is contained in:
Jamie Curnow
2023-05-30 15:51:57 +10:00
parent 7edcb8e3cc
commit 98ff4a7dcc
7 changed files with 144 additions and 152 deletions

View File

@ -12,6 +12,7 @@ import (
"gorm.io/driver/mysql"
"gorm.io/driver/postgres"
"gorm.io/gorm"
gormlogger "gorm.io/gorm/logger"
"gorm.io/gorm/schema"
)
@ -62,6 +63,7 @@ func connect() (*gorm.DB, error) {
NoLowerCase: true,
},
PrepareStmt: false,
Logger: gormlogger.Default.LogMode(gormlogger.Silent),
})
}

View File

@ -83,7 +83,9 @@ func List(pageInfo model.PageInfo, filters []model.Filter, expand []string) (ent
// DeleteAll will do just that, and should only be used for testing purposes.
func DeleteAll() error {
db := database.GetDB()
result := db.Exec("DELETE FROM user")
// nolint errcheck
db.Exec("DELETE FROM auth")
result := db.Exec("DELETE FROM user WHERE is_system = ?", false)
return result.Error
}