An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix(command): enhance database deletion command to support multiple database types
Andras Bacsaib17c65b224d5
diff --git a/app/Console/Commands/ServicesDelete.php b/app/Console/Commands/ServicesDelete.phpindex b5a74166a5..01f0e7cd5f 100644--- a/app/Console/Commands/ServicesDelete.php+++ b/app/Console/Commands/ServicesDelete.php@@ -6,7 +6,14 @@ use App\Jobs\DeleteResourceJob;use App\Models\Application;use App\Models\Server;use App\Models\Service;+use App\Models\StandaloneClickhouse;+use App\Models\StandaloneDragonfly;+use App\Models\StandaloneKeydb;+use App\Models\StandaloneMariadb;+use App\Models\StandaloneMongodb;+use App\Models\StandaloneMysql;use App\Models\StandalonePostgresql;+use App\Models\StandaloneRedis;use Illuminate\Console\Command;use function Laravel\Prompts\confirm;@@ -103,14 +110,40 @@ class ServicesDelete extends Commandprivate function deleteDatabase(){- $databases = StandalonePostgresql::all();+ $databaseType = select(+ 'What type of database do you want to delete?',+ [+ 'PostgreSQL' => 'PostgreSQL',+ 'MySQL' => 'MySQL',+ 'MariaDB' => 'MariaDB',+ 'MongoDB' => 'MongoDB',+ 'Redis' => 'Redis',+ 'KeyDB' => 'KeyDB',+ 'Dragonfly' => 'Dragonfly',+ 'ClickHouse' => 'ClickHouse',+ ],+ );++ $databases = match ($databaseType) {+ 'PostgreSQL' => StandalonePostgresql::all(),+ 'MySQL' => StandaloneMysql::all(),+ 'MariaDB' => StandaloneMariadb::all(),+ 'MongoDB' => StandaloneMongodb::all(),+ 'Redis' => StandaloneRedis::all(),+ 'KeyDB' => StandaloneKeydb::all(),+ 'Dragonfly' => StandaloneDragonfly::all(),+ 'ClickHouse' => StandaloneClickhouse::all(),+ default => collect(),+ };+if ($databases->count() === 0) {- $this->error('There are no databases to delete.');+ $this->error("There are no {$databaseType} databases to delete.");return;}+$databasesToDelete = multiselect(- 'What database do you want to delete?',+ "What {$databaseType} database do you want to delete?",$databases->pluck('name', 'id')->sortKeys(),);