diff --git a/src/Database/Adapter/SQL.php b/src/Database/Adapter/SQL.php index 07113d3d3..15c7322bf 100644 --- a/src/Database/Adapter/SQL.php +++ b/src/Database/Adapter/SQL.php @@ -1973,6 +1973,7 @@ public function createOrUpdateDocuments( $bindIndex = 0; $batchKeys = []; $bindValues = []; + $columns = []; foreach ($changes as $change) { $document = $change->getNew(); @@ -1982,10 +1983,16 @@ public function createOrUpdateDocuments( $attributes['_updatedAt'] = $document->getUpdatedAt(); $attributes['_permissions'] = \json_encode($document->getPermissions()); - if (!empty($document->getSequence())) { - $attributes['_id'] = $document->getSequence(); + $attributes['_id'] = null; + + if (!empty($change->getOld()->getSequence())) { + $attributes['_id'] = $change->getOld()->getSequence(); } +// if (!empty($document->getSequence())) { +// $attributes['_id'] = $document->getSequence(); +// } + if ($this->sharedTables) { $attributes['_tenant'] = $document->getTenant(); }