Skip to content

Commit

Permalink
Change to upsert
Browse files Browse the repository at this point in the history
  • Loading branch information
redthor committed Jan 16, 2017
1 parent ef1d637 commit cd1d6da
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/AntiMattr/MongoDB/Migrations/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ public function markMigrated($replay = false)

if ($replay) {
$query = array('v' => $this->version);
$collection->update($query, $document);
// If the user asked for a 'replay' of a migration that
// has not been run, it will be inserted anew
$options = array('upsert' => true);
$collection->update($query, $document, $options);
} else {
$collection->insert($document);
}
Expand Down

0 comments on commit cd1d6da

Please sign in to comment.