Skip to content

Commit

Permalink
Use TRUNCATE...CASCADE to purge the database when reloading the fixtu…
Browse files Browse the repository at this point in the history
…res. Otherwise the command is failing when trying to purge a table with foreign keys.
  • Loading branch information
leabaertschi committed Jun 30, 2011
1 parent d6b4470 commit 2feb1ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Doctrine/Common/DataFixtures/Purger/ORMPurger.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function purge()

$platform = $this->em->getConnection()->getDatabasePlatform();
foreach($orderedTables as $tbl) {
$this->em->getConnection()->executeUpdate($platform->getTruncateTableSQL($tbl));
$this->em->getConnection()->executeUpdate($platform->getTruncateTableSQL($tbl, true));
}
}

Expand Down Expand Up @@ -126,4 +126,4 @@ private function getAssociationTables(array $classes)

return $associationTables;
}
}
}

0 comments on commit 2feb1ab

Please sign in to comment.