From 7e71bdd875f8c69216072d4f5c48c799073f895c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane?= Date: Fri, 11 Sep 2020 18:22:42 +0200 Subject: [PATCH] Changing the dump and restore method for a PostgreSQL database --- src/Illuminate/Database/Console/DumpCommand.php | 2 +- src/Illuminate/Database/Console/Migrations/MigrateCommand.php | 2 +- src/Illuminate/Database/Schema/PostgresSchemaState.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Database/Console/DumpCommand.php b/src/Illuminate/Database/Console/DumpCommand.php index 7662823443e6..ef4c0beb593b 100644 --- a/src/Illuminate/Database/Console/DumpCommand.php +++ b/src/Illuminate/Database/Console/DumpCommand.php @@ -73,7 +73,7 @@ protected function schemaState(Connection $connection) */ protected function path(Connection $connection) { - return tap($this->option('path') ?: database_path('schema/'.$connection->getName().'-schema.sql'), function ($path) { + return tap($this->option('path') ?: database_path('schema/'.$connection->getName().'-schema.dump'), function ($path) { (new Filesystem)->ensureDirectoryExists(dirname($path)); }); } diff --git a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php index f547d8d5e80e..0f44d0b61a4e 100755 --- a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php +++ b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php @@ -166,6 +166,6 @@ protected function loadSchemaState() */ protected function schemaPath($connection) { - return $this->option('schema-path') ?: database_path('schema/'.$connection->getName().'-schema.sql'); + return $this->option('schema-path') ?: database_path('schema/'.$connection->getName().'-schema.dump'); } } diff --git a/src/Illuminate/Database/Schema/PostgresSchemaState.php b/src/Illuminate/Database/Schema/PostgresSchemaState.php index d7f1d46ae7d4..002795fc1812 100644 --- a/src/Illuminate/Database/Schema/PostgresSchemaState.php +++ b/src/Illuminate/Database/Schema/PostgresSchemaState.php @@ -51,7 +51,7 @@ protected function appendMigrationData(string $path) */ public function load($path) { - $process = $this->makeProcess('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'); + $process = $this->makeProcess('PGPASSWORD=$LARAVEL_LOAD_PASSWORD pg_restore --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER --dbname=$LARAVEL_LOAD_DATABASE $LARAVEL_LOAD_PATH'); $process->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ 'LARAVEL_LOAD_PATH' => $path, @@ -65,7 +65,7 @@ public function load($path) */ protected function baseDumpCommand() { - return 'PGPASSWORD=$LARAVEL_LOAD_PASSWORD pg_dump --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER $LARAVEL_LOAD_DATABASE'; + return 'PGPASSWORD=$LARAVEL_LOAD_PASSWORD pg_dump -Fc --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER $LARAVEL_LOAD_DATABASE'; } /**