chore: remove raw sql from env relationship

- raw sql should not be used whenever possible
- using sql to order on the relationship environment_variables() causes custom sorting to break or be additionally complicated
This commit is contained in:
peaklabs-dev
2026-01-06 16:18:37 +01:00
parent e9ef331def
commit 3af456cd35
10 changed files with 10 additions and 90 deletions

View File

@@ -323,15 +323,7 @@ class StandalonePostgresql extends BaseModel
public function environment_variables()
{
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
->orderByRaw("
CASE
WHEN LOWER(key) LIKE 'service_%' THEN 1
WHEN is_required = true AND (value IS NULL OR value = '') THEN 2
ELSE 3
END,
LOWER(key) ASC
");
return $this->morphMany(EnvironmentVariable::class, 'resourceable');
}
public function isBackupSolutionAvailable()