From 0d46d4d6e9348980cb5ab17207e6ee6eca0dde63 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 28 May 2025 15:54:58 +0300 Subject: [PATCH 1/4] Remove roles index --- app/config/collections/common.php | 7 ------- src/Appwrite/Migration/Version/V22.php | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/app/config/collections/common.php b/app/config/collections/common.php index e77d5403d2..6de7eb224b 100644 --- a/app/config/collections/common.php +++ b/app/config/collections/common.php @@ -1439,13 +1439,6 @@ return [ 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], - [ - '$id' => ID::custom('_key_roles'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['roles'], - 'lengths' => [128], - 'orders' => [], - ], ], ], diff --git a/src/Appwrite/Migration/Version/V22.php b/src/Appwrite/Migration/Version/V22.php index 2a6a64ed48..33e18e2956 100644 --- a/src/Appwrite/Migration/Version/V22.php +++ b/src/Appwrite/Migration/Version/V22.php @@ -145,17 +145,17 @@ class V22 extends Migration $this->dbForProject->purgeCachedCollection($id); break; case 'memberships': - $indexes = [ - '_key_roles', - ]; - foreach ($indexes as $index) { - try { - $this->createIndexFromCollection($this->dbForProject, $id, $index); - } catch (Throwable $th) { - Console::warning("Failed to create index \"$index\" from {$id}: {$th->getMessage()}"); - } - } - $this->dbForProject->purgeCachedCollection($id); +// $indexes = [ +// '_key_roles', +// ]; +// foreach ($indexes as $index) { +// try { +// $this->createIndexFromCollection($this->dbForProject, $id, $index); +// } catch (Throwable $th) { +// Console::warning("Failed to create index \"$index\" from {$id}: {$th->getMessage()}"); +// } +// } +// $this->dbForProject->purgeCachedCollection($id); break; case 'migrations': $attributes = [ From d7653c68cebaffb3d299f9058604604ac39831ad Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 29 May 2025 14:51:18 +0300 Subject: [PATCH 2/4] formatting --- src/Appwrite/Migration/Version/V22.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Appwrite/Migration/Version/V22.php b/src/Appwrite/Migration/Version/V22.php index 33e18e2956..a3197ec3d9 100644 --- a/src/Appwrite/Migration/Version/V22.php +++ b/src/Appwrite/Migration/Version/V22.php @@ -145,17 +145,17 @@ class V22 extends Migration $this->dbForProject->purgeCachedCollection($id); break; case 'memberships': -// $indexes = [ -// '_key_roles', -// ]; -// foreach ($indexes as $index) { -// try { -// $this->createIndexFromCollection($this->dbForProject, $id, $index); -// } catch (Throwable $th) { -// Console::warning("Failed to create index \"$index\" from {$id}: {$th->getMessage()}"); -// } -// } -// $this->dbForProject->purgeCachedCollection($id); + // $indexes = [ + // '_key_roles', + // ]; + // foreach ($indexes as $index) { + // try { + // $this->createIndexFromCollection($this->dbForProject, $id, $index); + // } catch (Throwable $th) { + // Console::warning("Failed to create index \"$index\" from {$id}: {$th->getMessage()}"); + // } + // } + // $this->dbForProject->purgeCachedCollection($id); break; case 'migrations': $attributes = [ From 0097a0edcd996896e34c4c83a1539601401e1614 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 29 May 2025 15:37:08 +0300 Subject: [PATCH 3/4] Update migration self-hosted --- src/Appwrite/Migration/Version/V22.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Appwrite/Migration/Version/V22.php b/src/Appwrite/Migration/Version/V22.php index a3197ec3d9..fd80af565b 100644 --- a/src/Appwrite/Migration/Version/V22.php +++ b/src/Appwrite/Migration/Version/V22.php @@ -145,17 +145,16 @@ class V22 extends Migration $this->dbForProject->purgeCachedCollection($id); break; case 'memberships': - // $indexes = [ - // '_key_roles', - // ]; - // foreach ($indexes as $index) { - // try { - // $this->createIndexFromCollection($this->dbForProject, $id, $index); - // } catch (Throwable $th) { - // Console::warning("Failed to create index \"$index\" from {$id}: {$th->getMessage()}"); - // } - // } - // $this->dbForProject->purgeCachedCollection($id); + $indexes = [ + '_key_roles', + ]; + foreach ($indexes as $index) { + try { + $this->dbForProject->deleteIndex($id, $index); + } catch (Throwable $th) { + Console::warning("Failed to delete index \"$index\" from {$id}: {$th->getMessage()}"); + } + } break; case 'migrations': $attributes = [ From 9829ba2afba6fc621ff581bda8754ed41bc3a0a0 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 29 May 2025 15:40:11 +0300 Subject: [PATCH 4/4] Not sure we need it but ok --- src/Appwrite/Migration/Version/V22.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Appwrite/Migration/Version/V22.php b/src/Appwrite/Migration/Version/V22.php index fd80af565b..cfe4f1fe57 100644 --- a/src/Appwrite/Migration/Version/V22.php +++ b/src/Appwrite/Migration/Version/V22.php @@ -155,6 +155,7 @@ class V22 extends Migration Console::warning("Failed to delete index \"$index\" from {$id}: {$th->getMessage()}"); } } + $this->dbForProject->purgeCachedCollection($id); break; case 'migrations': $attributes = [