Skip to content

Commit 05b1965

Browse files
committed
Use truncatate purging during load fixtures to fix compatibility for postgres
1 parent 57ef3e0 commit 05b1965

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/Command/LoadFixturesCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5656
}
5757

5858
$factory = new ResetAutoIncrementPurgerFactory();
59-
$purger = $factory->createForEntityManager(null, $this->entityManager);
59+
60+
//Use truncate purging to fix compatibility with postgresql
61+
$purger = $factory->createForEntityManager(null, $this->entityManager, purgeWithTruncate: true);
6062

6163
$purger->purge();
6264

6365
//Afterwards run the load fixtures command as normal, but with the --append option
6466
$new_input = new ArrayInput([
6567
'command' => 'doctrine:fixtures:load',
68+
'--purge-with-truncate' => true,
6669
'--append' => true,
6770
]);
6871

6972
$returnCode = $this->getApplication()?->doRun($new_input, $output);
7073

7174
return $returnCode ?? Command::FAILURE;
7275
}
73-
}
76+
}

0 commit comments

Comments
 (0)