Add port mappings for postgresql

Able to add init scripts fro postgresql
This commit is contained in:
Andras Bacsai
2023-08-08 14:35:01 +02:00
parent f2228cec7b
commit bd9a1dbaf3
12 changed files with 260 additions and 41 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -11,6 +12,7 @@ class StandalonePostgresql extends BaseModel
protected $guarded = [];
protected $casts = [
'init_scripts' => 'array',
'postgres_password' => 'encrypted',
];
@@ -28,6 +30,25 @@ class StandalonePostgresql extends BaseModel
});
}
public function portsMappings(): Attribute
{
return Attribute::make(
set: fn($value) => $value === "" ? null : $value,
);
}
// Normal Deployments
public function portsMappingsArray(): Attribute
{
return Attribute::make(
get: fn() => is_null($this->ports_mappings)
? []
: explode(',', $this->ports_mappings),
);
}
public function type()
{
return 'standalone-postgresql';