From c889bf54d367cdac53c654b0307a46a3dfadbe43 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 6 Jun 2023 18:36:05 +0300 Subject: [PATCH 01/16] V19 --- src/Appwrite/Migration/Migration.php | 4 + src/Appwrite/Migration/Version/V19.php | 157 +++++++++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 src/Appwrite/Migration/Version/V19.php diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 7a1f3cad24d..0ac6fdb22f6 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -131,6 +131,10 @@ public function setPDO(\PDO $pdo): self */ public function forEachDocument(callable $callback): void { + + return; + + foreach ($this->collections as $collection) { if ($collection['$collection'] !== Database::METADATA) { continue; diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php new file mode 100644 index 00000000000..b0fcaddd84a --- /dev/null +++ b/src/Appwrite/Migration/Version/V19.php @@ -0,0 +1,157 @@ + null, + fn () => [] + ); + } + + Console::log('Migrating Project: ' . $this->project->getAttribute('name') . ' (' . $this->project->getId() . ')'); + $this->projectDB->setNamespace("_{$this->project->getInternalId()}"); + + $this->alterPermissionIndex('_' . $this->project->getInternalId() . '__metadata'); + + Console::info('Migrating Databases'); + $this->migrateDatabases(); + + Console::info('Migrating Collections'); + $this->migrateCollections(); + + Console::info('Migrating Documents'); + $this->forEachDocument([$this, 'fixDocument']); + } + + /** + * Migrate all Databases. + * + * @return void + * @throws \Exception + */ + private function migrateDatabases(): void + { + foreach ($this->documentsIterator('databases') as $database) { + $databaseTable = "database_{$database->getInternalId()}"; + + Console::info("Migrating Collections of {$database->getId()} ({$database->getAttribute('name')})"); + + $this->alterPermissionIndex($databaseTable); + + foreach ($this->documentsIterator($databaseTable) as $collection) { + $collectionTable = "{$databaseTable}_collection_{$collection->getInternalId()}"; + + $this->alterPermissionIndex($collectionTable); + } + } + } + + /** + * Migrate all Collections. + * + * @return void + */ + private function migrateCollections(): void + { + foreach ($this->collections as $collection) { + $id = $collection['$id']; + + Console::log("Migrating Collection \"{$id}\""); + + $this->alterPermissionIndex($id); + + + usleep(50000); + } + } + + /** + * Fix run on each document + * + * @param Document $document + * @return Document + */ + protected function fixDocument(Document $document): Document + { + switch ($document->getCollection()) { + case 'projects': + /** + * Bump version number. + */ + $document->setAttribute('version', '1.3.0'); + + /** + * Set default passwordHistory + */ + $document->setAttribute('auths', array_merge([ + 'passwordHistory' => 0, + 'passwordDictionary' => false, + ], $document->getAttribute('auths', []))); + break; + case 'users': + /** + * Default Password history + */ + $document->setAttribute('passwordHistory', $document->getAttribute('passwordHistory', [])); + break; + case 'teams': + /** + * Default prefs + */ + $document->setAttribute('prefs', $document->getAttribute('prefs', new \stdClass())); + break; + case 'attributes': + /** + * Default options + */ + $document->setAttribute('options', $document->getAttribute('options', new \stdClass())); + break; + case 'buckets': + /** + * Set the bucket permission in the metadata table + */ + try { + $internalBucketId = "bucket_{$this->project->getInternalId()}"; + $permissions = $document->getPermissions(); + $fileSecurity = $document->getAttribute('fileSecurity', false); + $this->projectDB->updateCollection($internalBucketId, $permissions, $fileSecurity); + } catch (\Throwable $th) { + Console::warning($th->getMessage()); + } + break; + } + + return $document; + } + + protected function alterPermissionIndex($collectionName): void + { + $collectionName = "`{$this->projectDB->getDefaultDatabase()}`.`{$collectionName}_perms`"; + + try { + $this->pdo->prepare("ALTER TABLE {$collectionName} + DROP INDEX `_permission` , + ADD INDEX `_permission` (`_permission`, `_type`, `_document`); + ")->execute(); + } catch (\Throwable $th) { + Console::warning($th->getMessage()); + } + } +} From 29fef070195d4898a75e329b0f0ad916ea36e74f Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 6 Jun 2023 18:45:06 +0300 Subject: [PATCH 02/16] composer.lock --- composer.lock | 2 +- src/Appwrite/Migration/Version/V19.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index c9a99337731..3bf6f962bcf 100644 --- a/composer.lock +++ b/composer.lock @@ -5677,5 +5677,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index b0fcaddd84a..1f23c95966f 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -28,7 +28,7 @@ public function execute(): void Console::log('Migrating Project: ' . $this->project->getAttribute('name') . ' (' . $this->project->getId() . ')'); $this->projectDB->setNamespace("_{$this->project->getInternalId()}"); - $this->alterPermissionIndex('_' . $this->project->getInternalId() . '__metadata'); + $this->alterPermissionIndex('_metadata'); Console::info('Migrating Databases'); $this->migrateDatabases(); @@ -77,7 +77,6 @@ private function migrateCollections(): void $this->alterPermissionIndex($id); - usleep(50000); } } @@ -143,7 +142,7 @@ protected function fixDocument(Document $document): Document protected function alterPermissionIndex($collectionName): void { - $collectionName = "`{$this->projectDB->getDefaultDatabase()}`.`{$collectionName}_perms`"; + $collectionName = "`{$this->projectDB->getDefaultDatabase()}`.`'_{$this->project->getInternalId()}_{$collectionName}_perms`"; try { $this->pdo->prepare("ALTER TABLE {$collectionName} From 105d0a52128c363828083703b6565483ff13e967 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 6 Jun 2023 18:47:11 +0300 Subject: [PATCH 03/16] migrateBuckets --- src/Appwrite/Migration/Version/V19.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 1f23c95966f..806f9a31c6f 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -36,6 +36,9 @@ public function execute(): void Console::info('Migrating Collections'); $this->migrateCollections(); + Console::info('Migrating Buckets'); + $this->migrateBuckets(); + Console::info('Migrating Documents'); $this->forEachDocument([$this, 'fixDocument']); } @@ -153,4 +156,20 @@ protected function alterPermissionIndex($collectionName): void Console::warning($th->getMessage()); } } + + /** + * Migrating all Bucket tables. + * + * @return void + * @throws \Exception + * @throws \PDOException + */ + protected function migrateBuckets(): void + { + foreach ($this->documentsIterator('buckets') as $bucket) { + $id = "bucket_{$bucket->getInternalId()}"; + $this->alterPermissionIndex($id); + } + } + } From 2a9b76b205e1b24700b85b4053d3f3a779c1bd1c Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 7 Jun 2023 09:46:24 +0300 Subject: [PATCH 04/16] Separates for 2 queries --- src/Appwrite/Migration/Version/V19.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 806f9a31c6f..0dc35a639b3 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -148,10 +148,13 @@ protected function alterPermissionIndex($collectionName): void $collectionName = "`{$this->projectDB->getDefaultDatabase()}`.`'_{$this->project->getInternalId()}_{$collectionName}_perms`"; try { - $this->pdo->prepare("ALTER TABLE {$collectionName} - DROP INDEX `_permission` , - ADD INDEX `_permission` (`_permission`, `_type`, `_document`); - ")->execute(); + $this->pdo->prepare("ALTER TABLE {$collectionName} DROP INDEX `_permission`")->execute(); + } catch (\Throwable $th) { + Console::warning($th->getMessage()); + } + + try { + $this->pdo->prepare("ALTER TABLE {$collectionName} ADD INDEX `_permission` (`_permission`, `_type`, `_document`)")->execute(); } catch (\Throwable $th) { Console::warning($th->getMessage()); } From 1fea564735316ba665e0eaeba50a2b81a570d216 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 7 Jun 2023 09:59:13 +0300 Subject: [PATCH 05/16] Add index --- src/Appwrite/Migration/Version/V19.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 0dc35a639b3..cac3976a628 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -154,7 +154,7 @@ protected function alterPermissionIndex($collectionName): void } try { - $this->pdo->prepare("ALTER TABLE {$collectionName} ADD INDEX `_permission` (`_permission`, `_type`, `_document`)")->execute(); + $this->pdo->prepare("ALTER TABLE {$collectionName} ADD INDEX `_permission` (`_permission` ASC, `_type` ASC, `_document` ASC)")->execute(); } catch (\Throwable $th) { Console::warning($th->getMessage()); } From 8b9ab096b793ac154dcec1967cebb19f68844f19 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 7 Jun 2023 10:01:00 +0300 Subject: [PATCH 06/16] Add index --- src/Appwrite/Migration/Version/V19.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index cac3976a628..0dc35a639b3 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -154,7 +154,7 @@ protected function alterPermissionIndex($collectionName): void } try { - $this->pdo->prepare("ALTER TABLE {$collectionName} ADD INDEX `_permission` (`_permission` ASC, `_type` ASC, `_document` ASC)")->execute(); + $this->pdo->prepare("ALTER TABLE {$collectionName} ADD INDEX `_permission` (`_permission`, `_type`, `_document`)")->execute(); } catch (\Throwable $th) { Console::warning($th->getMessage()); } From 4c1fe6ce7c56bbf0ee3185e75af8566a09ddaa8c Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 7 Jun 2023 10:15:21 +0300 Subject: [PATCH 07/16] out comment document Migration --- src/Appwrite/Migration/Migration.php | 4 ---- src/Appwrite/Migration/Version/V19.php | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 0ac6fdb22f6..7a1f3cad24d 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -131,10 +131,6 @@ public function setPDO(\PDO $pdo): self */ public function forEachDocument(callable $callback): void { - - return; - - foreach ($this->collections as $collection) { if ($collection['$collection'] !== Database::METADATA) { continue; diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 0dc35a639b3..c9f2b60273f 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -39,8 +39,8 @@ public function execute(): void Console::info('Migrating Buckets'); $this->migrateBuckets(); - Console::info('Migrating Documents'); - $this->forEachDocument([$this, 'fixDocument']); + //Console::info('Migrating Documents'); + // $this->forEachDocument([$this, 'fixDocument']); } /** From b7536d62e22798a8fc553153d19603e4178f8c69 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 7 Jun 2023 10:26:55 +0300 Subject: [PATCH 08/16] lint --- src/Appwrite/Migration/Version/V19.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index c9f2b60273f..08f4789317c 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -174,5 +174,4 @@ protected function migrateBuckets(): void $this->alterPermissionIndex($id); } } - } From 9827d80f9cddf7b48ad4908ebd3831b2e160e766 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 7 Jun 2023 10:30:35 +0300 Subject: [PATCH 09/16] Add buckets --- src/Appwrite/Migration/Version/V19.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 08f4789317c..c2a593be25c 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -169,6 +169,8 @@ protected function alterPermissionIndex($collectionName): void */ protected function migrateBuckets(): void { + $this->alterPermissionIndex('buckets'); + foreach ($this->documentsIterator('buckets') as $bucket) { $id = "bucket_{$bucket->getInternalId()}"; $this->alterPermissionIndex($id); From 214bc4af56978a0cb56e6eb38ba6d6862b68105b Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 7 Jun 2023 10:32:46 +0300 Subject: [PATCH 10/16] Add buckets --- src/Appwrite/Migration/Version/V19.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index c2a593be25c..08f4789317c 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -169,8 +169,6 @@ protected function alterPermissionIndex($collectionName): void */ protected function migrateBuckets(): void { - $this->alterPermissionIndex('buckets'); - foreach ($this->documentsIterator('buckets') as $bucket) { $id = "bucket_{$bucket->getInternalId()}"; $this->alterPermissionIndex($id); From f729aaec2b1853f8d479e343965c42538a789ded Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 7 Jun 2023 10:40:15 +0300 Subject: [PATCH 11/16] version overwrite --- src/Appwrite/Migration/Migration.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 7a1f3cad24d..544e503ab51 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -62,7 +62,8 @@ abstract class Migration '1.3.4' => 'V18', '1.3.5' => 'V18', '1.3.6' => 'V18', - '1.3.7' => 'V18', + //'1.3.7' => 'V18', + '1.3.7' => 'V19', ]; /** From 46d5159fd0a98afcd05591147233e67c20f48483 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 7 Jun 2023 10:45:48 +0300 Subject: [PATCH 12/16] Small typo --- src/Appwrite/Migration/Version/V19.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 08f4789317c..7245eb49274 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -145,7 +145,7 @@ protected function fixDocument(Document $document): Document protected function alterPermissionIndex($collectionName): void { - $collectionName = "`{$this->projectDB->getDefaultDatabase()}`.`'_{$this->project->getInternalId()}_{$collectionName}_perms`"; + $collectionName = "`{$this->projectDB->getDefaultDatabase()}`.`_{$this->project->getInternalId()}_{$collectionName}_perms`"; try { $this->pdo->prepare("ALTER TABLE {$collectionName} DROP INDEX `_permission`")->execute(); From 371f195f3a58823f57ce01310da86541a5c25d1d Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 8 Jun 2023 10:53:40 +0300 Subject: [PATCH 13/16] Iterator messages --- src/Appwrite/Migration/Version/V19.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 7245eb49274..96c93763579 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -52,15 +52,15 @@ public function execute(): void private function migrateDatabases(): void { foreach ($this->documentsIterator('databases') as $database) { - $databaseTable = "database_{$database->getInternalId()}"; + Console::log("Migrating Collections of {$database->getId()} ({$database->getAttribute('name')})"); - Console::info("Migrating Collections of {$database->getId()} ({$database->getAttribute('name')})"); + $databaseTable = "database_{$database->getInternalId()}"; $this->alterPermissionIndex($databaseTable); foreach ($this->documentsIterator($databaseTable) as $collection) { $collectionTable = "{$databaseTable}_collection_{$collection->getInternalId()}"; - + Console::log("Migrating Collections of {$collectionTable} {$collection->getId()} ({$collection->getAttribute('name')})"); $this->alterPermissionIndex($collectionTable); } } @@ -78,7 +78,9 @@ private function migrateCollections(): void Console::log("Migrating Collection \"{$id}\""); - $this->alterPermissionIndex($id); + if (!in_array($id, ['files', 'collections'])) { + $this->alterPermissionIndex($id); + } usleep(50000); } @@ -171,6 +173,7 @@ protected function migrateBuckets(): void { foreach ($this->documentsIterator('buckets') as $bucket) { $id = "bucket_{$bucket->getInternalId()}"; + Console::log("Migrating Bucket {$id} {$bucket->getId()} ({$bucket->getAttribute('name')})"); $this->alterPermissionIndex($id); } } From 5ae534d291e1fa74d41d4ced63585ab3e12a5f9b Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 11 Jun 2023 10:59:44 +0300 Subject: [PATCH 14/16] Addressing comments --- src/Appwrite/Migration/Migration.php | 4 +- src/Appwrite/Migration/Version/V19.php | 60 +++----------------------- 2 files changed, 9 insertions(+), 55 deletions(-) diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 544e503ab51..6d315aa2e34 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -62,8 +62,8 @@ abstract class Migration '1.3.4' => 'V18', '1.3.5' => 'V18', '1.3.6' => 'V18', - //'1.3.7' => 'V18', - '1.3.7' => 'V19', + '1.3.7' => 'V18', + '1.4.0' => 'V19', ]; /** diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 96c93763579..2e52539c919 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -6,8 +6,6 @@ use Utopia\CLI\Console; use Utopia\Database\Database; use Utopia\Database\Document; -use Utopia\Database\Helpers\Permission; -use Utopia\Database\Helpers\Role; class V19 extends Migration { @@ -39,8 +37,8 @@ public function execute(): void Console::info('Migrating Buckets'); $this->migrateBuckets(); - //Console::info('Migrating Documents'); - // $this->forEachDocument([$this, 'fixDocument']); + Console::info('Migrating Documents'); + $this->forEachDocument([$this, 'fixDocument']); } /** @@ -99,46 +97,7 @@ protected function fixDocument(Document $document): Document /** * Bump version number. */ - $document->setAttribute('version', '1.3.0'); - - /** - * Set default passwordHistory - */ - $document->setAttribute('auths', array_merge([ - 'passwordHistory' => 0, - 'passwordDictionary' => false, - ], $document->getAttribute('auths', []))); - break; - case 'users': - /** - * Default Password history - */ - $document->setAttribute('passwordHistory', $document->getAttribute('passwordHistory', [])); - break; - case 'teams': - /** - * Default prefs - */ - $document->setAttribute('prefs', $document->getAttribute('prefs', new \stdClass())); - break; - case 'attributes': - /** - * Default options - */ - $document->setAttribute('options', $document->getAttribute('options', new \stdClass())); - break; - case 'buckets': - /** - * Set the bucket permission in the metadata table - */ - try { - $internalBucketId = "bucket_{$this->project->getInternalId()}"; - $permissions = $document->getPermissions(); - $fileSecurity = $document->getAttribute('fileSecurity', false); - $this->projectDB->updateCollection($internalBucketId, $permissions, $fileSecurity); - } catch (\Throwable $th) { - Console::warning($th->getMessage()); - } + $document->setAttribute('version', '1.4.0'); break; } @@ -147,16 +106,11 @@ protected function fixDocument(Document $document): Document protected function alterPermissionIndex($collectionName): void { - $collectionName = "`{$this->projectDB->getDefaultDatabase()}`.`_{$this->project->getInternalId()}_{$collectionName}_perms`"; - - try { - $this->pdo->prepare("ALTER TABLE {$collectionName} DROP INDEX `_permission`")->execute(); - } catch (\Throwable $th) { - Console::warning($th->getMessage()); - } - try { - $this->pdo->prepare("ALTER TABLE {$collectionName} ADD INDEX `_permission` (`_permission`, `_type`, `_document`)")->execute(); + $this->pdo->prepare("ALTER TABLE `{$this->projectDB->getDefaultDatabase()}`.`_{$this->project->getInternalId()}_{$collectionName}_perms` + DROP INDEX `_permission`, + ADD INDEX `_permission` (`_permission`, `_type`, `_document`) + ")->execute(); } catch (\Throwable $th) { Console::warning($th->getMessage()); } From 2c15f0bc7bf1b7e077b706426fb8bd3038a8607a Mon Sep 17 00:00:00 2001 From: Shmuel Fogel Date: Wed, 21 Jun 2023 09:43:29 +0300 Subject: [PATCH 15/16] Update src/Appwrite/Migration/Version/V19.php Co-authored-by: Jake Barnby --- src/Appwrite/Migration/Version/V19.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 2e52539c919..d53c132ecc5 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -107,9 +107,11 @@ protected function fixDocument(Document $document): Document protected function alterPermissionIndex($collectionName): void { try { - $this->pdo->prepare("ALTER TABLE `{$this->projectDB->getDefaultDatabase()}`.`_{$this->project->getInternalId()}_{$collectionName}_perms` - DROP INDEX `_permission`, - ADD INDEX `_permission` (`_permission`, `_type`, `_document`) + $table = "`{$this->projectDB->getDefaultDatabase()}`.`_{$this->project->getInternalId()}_{$collectionName}_perms"; + $this->pdo->prepare(" + ALTER TABLE {$table} + DROP INDEX `_permission`, + ADD INDEX `_permission` (`_permission`, `_type`, `_document`); ")->execute(); } catch (\Throwable $th) { Console::warning($th->getMessage()); From e5e071955372f720fee3324abdd0e7a327f5780c Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 21 Jun 2023 09:44:18 +0300 Subject: [PATCH 16/16] Update query merge --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 3bf6f962bcf..4fae7f56194 100644 --- a/composer.lock +++ b/composer.lock @@ -3200,16 +3200,16 @@ }, { "name": "matthiasmullie/minify", - "version": "1.3.70", + "version": "1.3.71", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "2807d9f9bece6877577ad44acb5c801bb3ae536b" + "reference": "ae42a47d7fecc1fbb7277b2f2d84c37a33edc3b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/2807d9f9bece6877577ad44acb5c801bb3ae536b", - "reference": "2807d9f9bece6877577ad44acb5c801bb3ae536b", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/ae42a47d7fecc1fbb7277b2f2d84c37a33edc3b1", + "reference": "ae42a47d7fecc1fbb7277b2f2d84c37a33edc3b1", "shasum": "" }, "require": { @@ -3259,7 +3259,7 @@ ], "support": { "issues": "https://github.com/matthiasmullie/minify/issues", - "source": "https://github.com/matthiasmullie/minify/tree/1.3.70" + "source": "https://github.com/matthiasmullie/minify/tree/1.3.71" }, "funding": [ { @@ -3267,7 +3267,7 @@ "type": "github" } ], - "time": "2022-12-09T12:56:44+00:00" + "time": "2023-04-25T20:33:03+00:00" }, { "name": "matthiasmullie/path-converter", @@ -5581,16 +5581,16 @@ }, { "name": "twig/twig", - "version": "v3.6.0", + "version": "v3.6.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "106c170d08e8415d78be2d16c3d057d0d108262b" + "reference": "7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/106c170d08e8415d78be2d16c3d057d0d108262b", - "reference": "106c170d08e8415d78be2d16c3d057d0d108262b", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd", + "reference": "7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd", "shasum": "" }, "require": { @@ -5636,7 +5636,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.6.0" + "source": "https://github.com/twigphp/Twig/tree/v3.6.1" }, "funding": [ { @@ -5648,7 +5648,7 @@ "type": "tidelift" } ], - "time": "2023-05-03T19:06:57+00:00" + "time": "2023-06-08T12:52:13+00:00" } ], "aliases": [],