From 5fd13990aa88001816d1230d66d6ed8d2c472b35 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 29 Oct 2020 13:25:42 +0200 Subject: [PATCH 1/3] Fixed command --- bin/sdks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sdks b/bin/sdks index bf117125f2..ab73414829 100644 --- a/bin/sdks +++ b/bin/sdks @@ -1,3 +1,3 @@ #!/bin/sh -php /usr/src/code/app/cli.php sdk $@ \ No newline at end of file +php /usr/src/code/app/cli.php sdks $@ \ No newline at end of file From 8d909539a8990b2653983941edb2f3ac37ca6691 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 29 Oct 2020 13:30:34 +0200 Subject: [PATCH 2/3] Missing table delete --- src/Appwrite/Database/Adapter/MySQL.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Appwrite/Database/Adapter/MySQL.php b/src/Appwrite/Database/Adapter/MySQL.php index d361433df0..313a9075f1 100644 --- a/src/Appwrite/Database/Adapter/MySQL.php +++ b/src/Appwrite/Database/Adapter/MySQL.php @@ -459,6 +459,7 @@ class MySQL extends Adapter throw new Exception('Empty namespace'); } + $unique = 'app_'.$namespace.'.database.unique'; $documents = 'app_'.$namespace.'.database.documents'; $properties = 'app_'.$namespace.'.database.properties'; $relationships = 'app_'.$namespace.'.database.relationships'; @@ -466,6 +467,7 @@ class MySQL extends Adapter $abuse = 'app_'.$namespace.'.abuse.abuse'; try { + $this->getPDO()->prepare('DROP TABLE `'.$unique.'`;')->execute(); $this->getPDO()->prepare('DROP TABLE `'.$documents.'`;')->execute(); $this->getPDO()->prepare('DROP TABLE `'.$properties.'`;')->execute(); $this->getPDO()->prepare('DROP TABLE `'.$relationships.'`;')->execute(); From a56ca3535ae4ebb62c9ce0e633b45fd7de501a50 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 29 Oct 2020 13:32:39 +0200 Subject: [PATCH 3/3] Updated document missing encode/decode action --- src/Appwrite/Database/Database.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Database/Database.php b/src/Appwrite/Database/Database.php index 70725a89df..51b46d265d 100644 --- a/src/Appwrite/Database/Database.php +++ b/src/Appwrite/Database/Database.php @@ -158,7 +158,7 @@ class Database $results = $this->adapter->getCollection($options); foreach ($results as &$node) { - $node = new Document($node); + $node = $this->decode(new Document($node)); } return $results; @@ -317,13 +317,19 @@ class Database throw new AuthorizationException($validator->getDescription()); // var_dump($validator->getDescription()); return false; } + $new = $this->encode($new); + $validator = new Structure($this); if (!$validator->isValid($new)) { // Make sure updated structure still apply collection rules (if any) throw new StructureException($validator->getDescription()); // var_dump($validator->getDescription()); return false; } - return new Document($this->adapter->updateDocument($data)); + $new = new Document($this->adapter->updateDocument($new->getArrayCopy())); + + $new = $this->decode($new); + + return $new; } /**