Laravel vapor fails when trying to run migrations for Postgres using pgsql-schema.dump

625 Views Asked by At

When doing a deploy using laravel vapor, I get the following error. I am using a pgsql-schema.dump for my migrations, but it doesn't seem to be able to handle it. I no longer have the original migrations to try as they got pruned when generating the dump. (See below)

Many Thanks

Hook: migrate --force Migration table created successfully. Loading stored database schema: /var/task/database/schema/pgsql-schema.dump

Symfony\Component\Process\Exception\ProcessFailedException

The command "pg_restore --no-owner --no-acl --clean --if-exists --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --username="${:LARAVEL_LOAD_USER}" --dbname="${:LARAVEL_LOAD_DATABASE}" "${:LARAVEL_LOAD_PATH}"" failed.

Exit Code: 127(Command not found)

Working directory: /var/task

Output:

Error Output:

sh: pg_restore: command not found

at vendor/symfony/process/Process.php:267 263▕ */ 264▕ public function mustRun(callable $callback = null, array $env = []): static 265▕ { 266▕ if (0 !== $this->run($callback, $env)) { ➜ 267▕ throw new ProcessFailedException($this); 268▕ } 269▕ 270▕ return $this; 271▕ }

  +19 vendor frames

20 artisan:43 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

1

There are 1 best solutions below

0
Dejan Stankovic On

I just came accross the same issue on mysql database. The error occured because I didn't have installed mysql-client, so I guess the same goes for you, just for the pgsql. I am running vapor with docker runtime, so in my coresponding {environment}.Dockerfile I just added the following line RUN apk add --no-cache mysql-client. For you it would probably be RUN apk add --no-cache pdo_pgsql.