laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.68k stars 11.05k forks source link

Can't migrate dumped pgsql-schema.dump file #34919

Closed simtrax closed 4 years ago

simtrax commented 4 years ago

Description:

I get an error message when trying to migrate a PostgreSQL dump file that is created with the schema:dump command.

Here's the message:

Migration table created successfully.
Loading stored database schema: /home/simon/Programmering/web/squash-dump/database/schema/pgsql-schema.dump

   Symfony\Component\Process\Exception\ProcessFailedException 

  The command "PGPASSWORD=$LARAVEL_LOAD_PASSWORD psql --file=$LARAVEL_LOAD_PATH --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER --dbname=$LARAVEL_LOAD_DATABASE" failed.

Exit Code: 1(General error)

Working directory: /home/simon/Programmering/web/squash-dump

Output:
================
The input is a PostgreSQL custom-format dump.
Use the pg_restore command-line client to restore this dump to a database.

Error Output:
================

  at vendor/symfony/process/Process.php:252
    248▕      */
    249▕     public function mustRun(callable $callback = null, array $env = []): self
    250▕     {
    251▕         if (0 !== $this->run($callback, $env)) {
  ➜ 252▕             throw new ProcessFailedException($this);
    253▕         }
    254▕ 
    255▕         return $this;
    256▕     }

      +19 vendor frames 
  20  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

Steps To Reproduce:

  1. Create new Laravel project.
  2. Change driver to pgsql in .env file. Update database credentials to match your database.
  3. Run php artisan migrate (don't know if this is needed).
  4. Run php artisan schema:dump --prune to create pgsql-schema.dump file in schema folder. And remove the migration files.
  5. I then removed the tables in the database manually by dropping them or delete if you are using a GUI.
  6. Try to run php artisan migrate. Should now get an error.
taylorotwell commented 4 years ago

Fixed in next patch.