Skip to content

Commit

Permalink
no-issue - fix Anonymize cmd (#82)
Browse files Browse the repository at this point in the history
* no-issue - Anonymize cmd - backup and restore initial database in non interactive mode

* Fix PgSQL Backupper

* simplification
  • Loading branch information
SimonMellerin authored Feb 12, 2024
1 parent 5b67265 commit 44b1cac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Backupper/PgSQL/Backupper.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ public function startBackup(): self
$args[] = '-Z'; // compression level 0-9
$args[] = '5';
$args[] = '--lock-wait-timeout=120';
$args[] = '--exclude-table-data=' . \implode('|', $this->excludedTables);
$args[] = '--blobs';
if ($this->excludedTables) {
$args[] = '--exclude-table-data=' . \implode('|', $this->excludedTables);
}
$args[] = $dbParams['dbname'];

if ($this->verbose) {
Expand Down
4 changes: 2 additions & 2 deletions src/Command/Anonymization/AnonymizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AnonymizeCommand extends Command

// Command behavior
private bool $doAnonymizeCurrentDatabase = false;
private ?bool $doBackupAndRestoreInitial = null;
private bool $doBackupAndRestoreInitial = true;
private bool $doCancel = false;

// Anonmyzation options
Expand Down Expand Up @@ -173,7 +173,7 @@ protected function interact(InputInterface $input, OutputInterface $output): voi
return;
}

if (null === $this->doBackupAndRestoreInitial) {
if ($this->doBackupAndRestoreInitial) {
$this->doBackupAndRestoreInitial = $this->io->confirm("Do you want to backup local database and restore it at the end of this process?", true);
}

Expand Down

0 comments on commit 44b1cac

Please sign in to comment.