diff options
Diffstat (limited to 'store/sqlstore')
-rw-r--r-- | store/sqlstore/role_supplier.go | 10 | ||||
-rw-r--r-- | store/sqlstore/system_store.go | 11 |
2 files changed, 21 insertions, 0 deletions
diff --git a/store/sqlstore/role_supplier.go b/store/sqlstore/role_supplier.go index 828f4484e..ddbdaca52 100644 --- a/store/sqlstore/role_supplier.go +++ b/store/sqlstore/role_supplier.go @@ -174,3 +174,13 @@ func (s *SqlSupplier) RoleGetByNames(ctx context.Context, names []string, hints return result } + +func (s *SqlSupplier) RolePermanentDeleteAll(ctx context.Context, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult { + result := store.NewSupplierResult() + + if _, err := s.GetMaster().Exec("DELETE FROM Roles"); err != nil { + result.Err = model.NewAppError("SqlRoleStore.PermanentDeleteAll", "store.sql_role.permanent_delete_all.app_error", nil, err.Error(), http.StatusInternalServerError) + } + + return result +} diff --git a/store/sqlstore/system_store.go b/store/sqlstore/system_store.go index 496ff2ced..4065bb955 100644 --- a/store/sqlstore/system_store.go +++ b/store/sqlstore/system_store.go @@ -85,3 +85,14 @@ func (s SqlSystemStore) GetByName(name string) store.StoreChannel { result.Data = &system }) } + +func (s SqlSystemStore) PermanentDeleteByName(name string) store.StoreChannel { + return store.Do(func(result *store.StoreResult) { + var system model.System + if _, err := s.GetReplica().Exec("DELETE FROM Systems WHERE Name = :Name", map[string]interface{}{"Name": name}); err != nil { + result.Err = model.NewAppError("SqlSystemStore.PermanentDeleteByName", "store.sql_system.permanent_delete_by_name.app_error", nil, "", http.StatusInternalServerError) + } + + result.Data = &system + }) +} |