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 init scripts for postgres
peaklabs-dev2dcfdcab3bc0
diff --git a/app/Livewire/Project/Database/Postgresql/General.php b/app/Livewire/Project/Database/Postgresql/General.phpindex c12fa49f34..642aa793db 100644--- a/app/Livewire/Project/Database/Postgresql/General.php+++ b/app/Livewire/Project/Database/Postgresql/General.php@@ -9,8 +9,6 @@ use App\Models\StandalonePostgresql;use Exception;use Livewire\Component;-use function Aws\filter;-class General extends Component{public StandalonePostgresql $database;@@ -126,8 +124,31 @@ class General extends Componentpublic function save_init_script($script){- $this->database->init_scripts = filter($this->database->init_scripts, fn ($s) => $s['filename'] !== $script['filename']);- $this->database->init_scripts = array_merge($this->database->init_scripts, [$script]);+ $initScripts = collect($this->database->init_scripts ?? []);++ $existingScript = $initScripts->firstWhere('filename', $script['filename']);+ if ($existingScript && $existingScript['index'] !== $script['index']) {+ $this->dispatch('error', 'A script with this filename already exists.');++ return;+ }++ $index = $initScripts->search(function ($item) use ($script) {+ return $item['index'] === $script['index'];+ });++ if ($index !== false) {+ $initScripts[$index] = $script;+ } else {+ $initScripts->push($script);+ }++ $this->database->init_scripts = $initScripts->values()->map(function ($item, $index) {+ $item['index'] = $index;++ return $item;+ })->all();+$this->database->save();$this->dispatch('success', 'Init script saved.');}