Skip to content

Commit 685698e

Browse files
committed
Fix cache bypass for overwrite mode and validate overwrite+skip exclusivity
1 parent 0ef24fa commit 685698e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/Migration/Destinations/Appwrite.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,18 @@ class Appwrite extends Destination
9090

9191
public function setOverwrite(bool $overwrite): self
9292
{
93+
if ($overwrite && $this->skip) {
94+
throw new \InvalidArgumentException('Cannot set both overwrite and skip to true.');
95+
}
9396
$this->overwrite = $overwrite;
9497
return $this;
9598
}
9699

97100
public function setSkip(bool $skip): self
98101
{
102+
if ($skip && $this->overwrite) {
103+
throw new \InvalidArgumentException('Cannot set both skip and overwrite to true.');
104+
}
99105
$this->skip = $skip;
100106
return $this;
101107
}
@@ -1001,7 +1007,7 @@ protected function createRecord(Row $resource, bool $isLast): bool
10011007
$this->cache->get($resource->getName())
10021008
);
10031009

1004-
if ($exists) {
1010+
if ($exists && !$this->overwrite) {
10051011
$resource->setStatus(
10061012
Resource::STATUS_SKIPPED,
10071013
'Row has already been created'

0 commit comments

Comments
 (0)