feat: init postgresql database

This commit is contained in:
Andras Bacsai
2023-08-07 18:46:40 +02:00
parent 0a040a0531
commit a020bc872d
38 changed files with 430 additions and 66 deletions

View File

@@ -17,6 +17,12 @@ class Environment extends Model
set: fn (string $value) => strtolower($value),
);
}
public function can_delete_environment() {
return $this->applications()->count() == 0 && $this->postgresqls()->count() == 0;
}
public function databases() {
return $this->postgresqls();
}
public function project()
{
return $this->belongsTo(Project::class);
@@ -25,12 +31,12 @@ class Environment extends Model
{
return $this->hasMany(Application::class);
}
public function databases()
public function postgresqls()
{
return $this->hasMany(Database::class);
return $this->hasMany(Postgresql::class);
}
public function services()
{
return $this->hasMany(Service::class);
}
}
}