rename postgres to standalonepostgres

This commit is contained in:
Andras Bacsai 2023-08-07 19:25:32 +02:00
parent a020bc872d
commit 20e1cd6d6b
10 changed files with 29 additions and 14 deletions

View File

@ -5,11 +5,11 @@ namespace App\Actions\Database;
use App\Models\Server;
use App\Models\StandaloneDocker;
use App\Models\Team;
use App\Models\Postgresql;
use App\Models\StandalonePostgres;
class StartPostgresql
{
public function __invoke(Server $server, Postgresql $database)
public function __invoke(Server $server, StandalonePostgres $database)
{
$activity = remote_process([
"echo 'Creating required Docker networks...'",

View File

@ -33,7 +33,7 @@ class Environment extends Model
}
public function postgresqls()
{
return $this->hasMany(Postgresql::class);
return $this->hasMany(StandalonePostgres::class);
}
public function services()
{

View File

@ -48,6 +48,6 @@ class Project extends BaseModel
}
public function postgresqls()
{
return $this->hasManyThrough(Postgresql::class, Environment::class);
return $this->hasManyThrough(StandalonePostgres::class, Environment::class);
}
}

View File

@ -15,7 +15,7 @@ class StandaloneDocker extends BaseModel
}
public function postgresqls()
{
return $this->morphMany(Postgresql::class, 'destination');
return $this->morphMany(StandalonePostgres::class, 'destination');
}
public function server()
{

View File

@ -4,7 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Postgresql extends BaseModel
class StandalonePostgres extends BaseModel
{
use HasFactory;
protected $guarded = [];

View File

@ -11,7 +11,7 @@ return new class extends Migration
*/
public function up(): void
{
Schema::create('postgresqls', function (Blueprint $table) {
Schema::create('standalone_postgres', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->string('name');
@ -37,6 +37,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfExists('postgresqls');
Schema::dropIfExists('standalone_postgres');
}
};

View File

@ -32,7 +32,7 @@ class DatabaseSeeder extends Seeder
EnvironmentVariableSeeder::class,
LocalPersistentVolumeSeeder::class,
S3StorageSeeder::class,
PostgresqlSeeder::class,
StandalonePostgresSeeder::class,
]);
}
}

View File

@ -4,17 +4,17 @@ namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Postgresql;
use App\Models\StandalonePostgres;
use App\Models\StandaloneDocker;
class PostgresqlSeeder extends Seeder
class StandalonePostgresSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Postgresql::create([
StandalonePostgres::create([
'name' => 'Local PostgreSQL',
'description' => 'Local PostgreSQL for testing',
'postgres_password' => 'postgres',

View File

@ -1,6 +1,6 @@
<div x-data x-init="$wire.load_servers">
<h1>New Resource</h1>
<div class="pb-4 ">Deploy any Git repository from different sources.</div>
<div class="pb-4 ">Deploy resources, like Applications, Databases, Services...</div>
<div class="flex flex-col pt-10">
@if ($current_step === 'type')
<ul class="pb-10 steps">
@ -8,6 +8,7 @@
<li class="step">Select a Server</li>
<li class="step">Select a Destination</li>
</ul>
<h3 class="pb-4">Applications</h3>
<div class="flex flex-col justify-center gap-2 text-left xl:flex-row">
<div class="gap-2 py-4 cursor-pointer group hover:bg-coollabs bg-coolgray-200"
wire:click="set_type('public')">
@ -40,6 +41,20 @@
</div>
</div>
</div>
<h3 class="py-4">Databases</h3>
<div class="flex flex-col justify-center gap-2 text-left xl:flex-row">
<div class="gap-2 py-4 cursor-pointer group hover:bg-coollabs bg-coolgray-200"
wire:click="set_type('postgresql')">
<div class="flex flex-col mx-6">
<div class="group-hover:text-white">
PostgreSQL
</div>
<div class="text-xs group-hover:text-white">
The most loved relational database in the world.</div>
</div>
</div>
</div>
@endif
@if ($current_step === 'servers')
<ul class="pb-10 steps">

View File

@ -38,7 +38,7 @@
</div>
<div class="w-full pl-8">
<div x-cloak x-show="activeTab === 'general'" class="h-full">
@if ($database->getMorphClass() === 'App\Models\Postgresql')
@if ($database->type() === 'postgresql')
<livewire:project.database.postgresql.general :database="$database" />
@endif
</div>