Skip to content

Commit cd1d6da

Browse files
committed
Change to upsert
1 parent ef1d637 commit cd1d6da

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/AntiMattr/MongoDB/Migrations/Version.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,10 @@ public function markMigrated($replay = false)
298298

299299
if ($replay) {
300300
$query = array('v' => $this->version);
301-
$collection->update($query, $document);
301+
// If the user asked for a 'replay' of a migration that
302+
// has not been run, it will be inserted anew
303+
$options = array('upsert' => true);
304+
$collection->update($query, $document, $options);
302305
} else {
303306
$collection->insert($document);
304307
}

0 commit comments

Comments
 (0)