-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
db/backup/restore refinements #14921
Conversation
->addArg('--single-transaction') | ||
->addArg('{file}'); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using pg_restore, these args need to be on the restore, regardless if the backup was created with them.
src/db/pgsql/Schema.php
Outdated
@@ -172,7 +186,7 @@ public function getDefaultRestoreCommand(): string | |||
|
|||
return $this->_pgpasswordCommand() | |||
. $command->getExecCommand() | |||
. '< "{file}"'; | |||
. ($this->usePgRestore() ? '' : '< "{file}"'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't use STDIN with pg_restore, because directory is a valid input.
if (!is_file($path)) { | ||
$this->stderr("Backup file doesn't exist: $path" . PHP_EOL); | ||
if (!is_readable($path)) { | ||
$this->stderr("Backup path doesn't exist: $path" . PHP_EOL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Account for a possible directory (pg_restore)
# Conflicts: # src/console/controllers/DbController.php # src/db/pgsql/Schema.php
See #14931 |
Description
#14897 tied the format set for backups (
backupCommandFormat
) with what is used for restoring, which is not ideal.This PR:
backupCommandFormat
from what is used for restore--format
options fordb/restore
anddb/backup
(for PG)db/restore
, if no--format
is passed, it will attempt to detect which pg_restore format should be used (custom
,directory
,tar
)db/restore
can be a directory, which is applicable for pg_restore.