From 98a56934502d0160966dfa6e2e20229c92091311 Mon Sep 17 00:00:00 2001 From: evgen-d Date: Mon, 11 Aug 2014 16:32:03 +0400 Subject: [PATCH] update remove fix --- Migration.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Migration.php b/Migration.php index 087f49a..ef33ee2 100644 --- a/Migration.php +++ b/Migration.php @@ -2,6 +2,7 @@ namespace devgroup\arangodb; +use triagens\ArangoDb\Document; use yii\base\Component; use yii\db\MigrationInterface; use yii\di\Instance; @@ -51,7 +52,10 @@ abstract class Migration extends Component implements MigrationInterface { echo " > update $collection ..."; $time = microtime(true); - (new Query())->update($collection, $columns, $condition, $params)->execute(); + $docs = (new Query())->select($collection)->from($collection)->where($condition, $params)->all(); + foreach ($docs as $doc) { + $this->db->getDocumentHandler()->updateById($collection, $doc['_key'], Document::createFromArray($columns)); + } echo " done (time: " . sprintf('%.3f', microtime(true) - $time) . "s)\n"; } @@ -59,7 +63,10 @@ abstract class Migration extends Component implements MigrationInterface { echo " > delete from $collection ..."; $time = microtime(true); - (new Query())->remove($collection, $condition, $params)->execute(); + $docs = (new Query())->select($collection)->from($collection)->where($condition, $params)->all(); + foreach ($docs as $doc) { + $this->db->getDocumentHandler()->removeById($collection, $doc['_key']); + } echo " done (time: " . sprintf('%.3f', microtime(true) - $time) . "s)\n"; }