Delete databases when we delete a server.
This commit is contained in:
parent
08b236ac1d
commit
55c9f0f2f2
1 changed files with 8 additions and 0 deletions
|
@ -788,6 +788,14 @@ class ServerRepository
|
||||||
// Remove Downloads
|
// Remove Downloads
|
||||||
Models\Download::where('server', $server->uuid)->delete();
|
Models\Download::where('server', $server->uuid)->delete();
|
||||||
|
|
||||||
|
// Delete Databases
|
||||||
|
$databases = Models\Database::select('id')->where('server_id', $server->id)->get();
|
||||||
|
$repository = new DatabaseRepository;
|
||||||
|
foreach($databases as &$database) {
|
||||||
|
// Use the repository to drop the database, we don't need to delete here because it is now gone.
|
||||||
|
$repository->drop($database->id);
|
||||||
|
}
|
||||||
|
|
||||||
$client = Models\Node::guzzleRequest($server->node);
|
$client = Models\Node::guzzleRequest($server->node);
|
||||||
$client->request('DELETE', '/servers', [
|
$client->request('DELETE', '/servers', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
|
|
Loading…
Reference in a new issue