Files
coolify/app/Support/DatabaseImport/DatabaseImportSource.php
T
Andras Bacsai 4accae95b5 feat(database): add replace-existing option for PostgreSQL restores
Allow single-database PostgreSQL imports to drop matching objects before restore. The API and import form accept replace_existing, which adds --clean --if-exists to pg_restore, and pg_restore now uses --exit-on-error.
2026-09-09 11:48:17 +02:00

22 lines
561 B
PHP

<?php
namespace App\Support\DatabaseImport;
use InvalidArgumentException;
readonly class DatabaseImportSource
{
public function __construct(
public string $type,
public ?string $uploadId = null,
public ?string $path = null,
public ?string $s3StorageUuid = null,
public bool $dumpAll = false,
public bool $replaceExisting = false,
) {
if (! in_array($type, ['upload', 's3', 'server'], true)) {
throw new InvalidArgumentException('Invalid database import source.');
}
}
}