From 2f334b5f9f7226581b0bc506912a5606170a0d94 Mon Sep 17 00:00:00 2001 From: Jamie Curnow Date: Wed, 13 Nov 2024 12:38:59 +1000 Subject: [PATCH] Fix ci clearing users not clearing auth --- backend/internal/entity/user/methods.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/backend/internal/entity/user/methods.go b/backend/internal/entity/user/methods.go index 266d1660..922f20be 100644 --- a/backend/internal/entity/user/methods.go +++ b/backend/internal/entity/user/methods.go @@ -89,8 +89,21 @@ 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(fmt.Sprintf(`DELETE FROM %s WHERE is_system = ?`, database.QuoteTableName("user")), false) - return result.Error + if result := db.Exec( + fmt.Sprintf(`DELETE FROM %s WHERE is_system = ?`, database.QuoteTableName("user")), + false, + ); result.Error != nil { + return result.Error + } + + if result := db.Exec( + fmt.Sprintf(`DELETE FROM %s`, database.QuoteTableName("auth")), + false, + ); result.Error != nil { + return result.Error + } + + return nil } // GetCapabilities gets capabilities for a user