-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Description
- Laravel Version: 8.24.0
- PHP Version: 7.4.11
- Database Driver & Version: PostgreSQL 12.4
Description:
Currently, Laravel's artisan migrate:fresh command fails after running artisan schema:dump in all but the simplest of scenarios — that is, this process works correctly only when the database contains exactly one schema and its name is public. In any other scenario, exceptions occur.
Steps To Reproduce:
- When the connection's
search_pathcontains only one schema, and it is anything other than the default value,public, attempting to runphp artisan migrate:freshafter runningschema:dumpfails (the sole schema ishomesteadin this example):
The command "PGPASSWORD=$LARAVEL_LOAD_PASSWORD pg_restore --no-owner --no-acl --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER --dbname=$LARAVEL_LOAD_DATABASE $LARAVEL_LOAD_PATH" failed.
Exit Code: 1(General error)
Working directory: /home/vagrant/code/laravel
Output:
================
Error Output:
================
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 3; 2615 2200 SCHEMA homestead postgres
pg_restore: error: could not execute query: ERROR: schema "homestead" already exists
Command was: CREATE SCHEMA homestead;
(and there are actually 15 additional errors that are ignored on restore, of a similar nature)
- Similarly, when the database contains more than one schema (regardless of those specified in the connection's
search_path), attempting to runphp artisan migrate:freshfails after runningartisan schema:dump, with similar exceptions (relation already exists, multiple primary keys not allowed, etc.).
I'm investigating possible solutions and will post an update or open a PR when ready.
Metadata
Metadata
Assignees
Labels
No labels