From 704fd8693c0b0b2f2e46b8947b44b95883f9b17f Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 12 Sep 2022 11:55:54 +0200 Subject: [PATCH] fix: migrate executions and write permissions --- src/Appwrite/Migration/Version/V15.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Migration/Version/V15.php b/src/Appwrite/Migration/Version/V15.php index e94c93ef2f..a214040578 100644 --- a/src/Appwrite/Migration/Version/V15.php +++ b/src/Appwrite/Migration/Version/V15.php @@ -325,6 +325,13 @@ class V15 extends Migration $permission = $this->migratePermission($result['_permission']); if ($type === 'write') { + /** + * Migrate write permissions from 'role:all' to 'role:member'. + */ + if ($permission === 'role:all') { + $permission = 'role:member'; + } + $permissions[] = "update(\"{$permission}\")"; $permissions[] = "delete(\"{$permission}\")"; if ($addCreatePermission) { @@ -564,6 +571,15 @@ class V15 extends Migration Console::warning("'stdout' from {$id}: {$th->getMessage()}"); } + try { + /** + * Rename 'time' to 'duration' + */ + $this->projectDB->renameAttribute($id, 'time', 'duration'); + } catch (\Throwable $th) { + Console::warning("'duration' from {$id}: {$th->getMessage()}"); + } + try { /** * Create '_key_trigger' index @@ -593,11 +609,11 @@ class V15 extends Migration try { /** - * Create '_key_time' index + * Create '_key_duration' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_time'); + $this->createIndexFromCollection($this->projectDB, $id, '_key_duration'); } catch (\Throwable $th) { - Console::warning("'_key_time' from {$id}: {$th->getMessage()}"); + Console::warning("'_key_duration' from {$id}: {$th->getMessage()}"); } break;