From 938ced2e904ff936813a2dd0b49a8d778b1a2808 Mon Sep 17 00:00:00 2001 From: fogelito Date: Fri, 30 Aug 2024 14:52:44 +0300 Subject: [PATCH 1/4] Disable Document cache --- src/Migration/Cache.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Migration/Cache.php b/src/Migration/Cache.php index e9d2de1..821a43d 100644 --- a/src/Migration/Cache.php +++ b/src/Migration/Cache.php @@ -44,6 +44,10 @@ public function add(Resource $resource): void $resource->setData(''); // Prevent Memory Leak } + if($resource->getName() == Resource::TYPE_DOCUMENT){ + return; + } + $this->cache[$resource->getName()][$resource->getInternalId()] = $resource; } @@ -75,6 +79,10 @@ public function update(Resource $resource): void $this->add($resource); } + if($resource->getName() == Resource::TYPE_DOCUMENT){ + return; + } + $this->cache[$resource->getName()][$resource->getInternalId()] = $resource; } From c473bd7ffaafd4c33dd485529717dd7933741b4a Mon Sep 17 00:00:00 2001 From: fogelito Date: Fri, 30 Aug 2024 14:55:03 +0300 Subject: [PATCH 2/4] lint --- src/Migration/Cache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Migration/Cache.php b/src/Migration/Cache.php index 821a43d..04f528b 100644 --- a/src/Migration/Cache.php +++ b/src/Migration/Cache.php @@ -44,7 +44,7 @@ public function add(Resource $resource): void $resource->setData(''); // Prevent Memory Leak } - if($resource->getName() == Resource::TYPE_DOCUMENT){ + if($resource->getName() == Resource::TYPE_DOCUMENT) { return; } @@ -79,7 +79,7 @@ public function update(Resource $resource): void $this->add($resource); } - if($resource->getName() == Resource::TYPE_DOCUMENT){ + if($resource->getName() == Resource::TYPE_DOCUMENT) { return; } From 10033e797b2e6359841d8bd6079351e0502c9d1a Mon Sep 17 00:00:00 2001 From: fogelito Date: Fri, 30 Aug 2024 15:37:16 +0300 Subject: [PATCH 3/4] comment document cache tests --- tests/Migration/E2E/Sources/SupabaseTest.php | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/Migration/E2E/Sources/SupabaseTest.php b/tests/Migration/E2E/Sources/SupabaseTest.php index 53096a5..385d56d 100644 --- a/tests/Migration/E2E/Sources/SupabaseTest.php +++ b/tests/Migration/E2E/Sources/SupabaseTest.php @@ -221,24 +221,24 @@ public function testValidateDatabaseTransfer($state) // Find Known Documents $documents = $state['source']->cache->get(Resource::TYPE_DOCUMENT); - $this->assertGreaterThan(0, count($documents)); - - $foundDocument = null; - - foreach ($documents as $document) { - /** @var Document $document */ - if ($document->getCollection()->getDatabase()->getDatabaseName() === 'public' && $document->getCollection()->getCollectionName() === 'test') { - $foundDocument = $document; - } - - break; - } - - if (! $foundDocument) { - $this->fail('Document "1" not found'); - } - - $this->assertEquals('success', $foundDocument->getStatus()); +// $this->assertGreaterThan(0, count($documents)); +// +// $foundDocument = null; +// +// foreach ($documents as $document) { +// /** @var Document $document */ +// if ($document->getCollection()->getDatabase()->getDatabaseName() === 'public' && $document->getCollection()->getCollectionName() === 'test') { +// $foundDocument = $document; +// } +// +// break; +// } +// +// if (! $foundDocument) { +// $this->fail('Document "1" not found'); +// } +// +// $this->assertEquals('success', $foundDocument->getStatus()); return $state; } From 530ed6674c9f0c99b8012bb91ac31bb0427d7619 Mon Sep 17 00:00:00 2001 From: fogelito Date: Fri, 30 Aug 2024 15:40:18 +0300 Subject: [PATCH 4/4] lint --- tests/Migration/E2E/Sources/SupabaseTest.php | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/Migration/E2E/Sources/SupabaseTest.php b/tests/Migration/E2E/Sources/SupabaseTest.php index 385d56d..ca06d8b 100644 --- a/tests/Migration/E2E/Sources/SupabaseTest.php +++ b/tests/Migration/E2E/Sources/SupabaseTest.php @@ -221,24 +221,24 @@ public function testValidateDatabaseTransfer($state) // Find Known Documents $documents = $state['source']->cache->get(Resource::TYPE_DOCUMENT); -// $this->assertGreaterThan(0, count($documents)); -// -// $foundDocument = null; -// -// foreach ($documents as $document) { -// /** @var Document $document */ -// if ($document->getCollection()->getDatabase()->getDatabaseName() === 'public' && $document->getCollection()->getCollectionName() === 'test') { -// $foundDocument = $document; -// } -// -// break; -// } -// -// if (! $foundDocument) { -// $this->fail('Document "1" not found'); -// } -// -// $this->assertEquals('success', $foundDocument->getStatus()); + // $this->assertGreaterThan(0, count($documents)); + // + // $foundDocument = null; + // + // foreach ($documents as $document) { + // /** @var Document $document */ + // if ($document->getCollection()->getDatabase()->getDatabaseName() === 'public' && $document->getCollection()->getCollectionName() === 'test') { + // $foundDocument = $document; + // } + // + // break; + // } + // + // if (! $foundDocument) { + // $this->fail('Document "1" not found'); + // } + // + // $this->assertEquals('success', $foundDocument->getStatus()); return $state; }