From 5542e5b04c628827094f662dd922ab0ee7e192df Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Tue, 11 Oct 2022 22:49:59 +0000 Subject: [PATCH 1/3] Only delete collection data for correct db Ensure attributes, indexes, and audit for correct database is deleted. --- app/workers/deletes.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/workers/deletes.php b/app/workers/deletes.php index 19ab56c69a..b015043b1d 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -193,21 +193,24 @@ class DeletesV1 extends Worker protected function deleteCollection(Document $document, string $projectId): void { $collectionId = $document->getId(); - $databaseId = str_replace('database_', '', $document->getCollection()); + $databaseId = $document->getAttribute('databaseId'); + $databaseInternalId = $document->getAttribute('databaseInternalId'); $dbForProject = $this->getProjectDB($projectId); - $dbForProject->deleteCollection('database_' . $databaseId . '_collection_' . $document->getInternalId()); + $dbForProject->deleteCollection('database_' . $databaseInternalId . '_collection_' . $document->getInternalId()); $this->deleteByGroup('attributes', [ + Query::equal('databaseId', [$databaseId]), Query::equal('collectionId', [$collectionId]) ], $dbForProject); $this->deleteByGroup('indexes', [ + Query::equal('databaseId', [$databaseId]), Query::equal('collectionId', [$collectionId]) ], $dbForProject); - $this->deleteAuditLogsByResource('collection/' . $collectionId, $projectId); + $this->deleteAuditLogsByResource('database/' . $databaseId . '/collection/' . $collectionId, $projectId); } /** From 99abb200d64e4e9c809e9be28abddd16e1fe0073 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Tue, 11 Oct 2022 22:56:55 +0000 Subject: [PATCH 2/3] Update CHANGES.md --- CHANGES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index df303e8555..60c6c71179 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +# Version 1.0.3 +## Bugs +- Fix document audit deletion [#4429](https://github.com/appwrite/appwrite/pull/4429) +- Fix attribute, index, and audit deletion [#4429](https://github.com/appwrite/appwrite/pull/4429) + # Version 1.0.2 ## Bugs - Fixed nullable values in functions variables [#3885](https://github.com/appwrite/appwrite/pull/3885) From bc66efa1a54ebe2e3db76bc902664392cbd87598 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 12 Oct 2022 12:03:55 +0200 Subject: [PATCH 3/3] chore: prepare 1.0.3 --- CHANGES.md | 2 +- README-CN.md | 6 +++--- README.md | 6 +++--- app/init.php | 2 +- src/Appwrite/Migration/Migration.php | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 60c6c71179..5e742d1405 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,7 @@ # Version 1.0.3 ## Bugs - Fix document audit deletion [#4429](https://github.com/appwrite/appwrite/pull/4429) -- Fix attribute, index, and audit deletion [#4429](https://github.com/appwrite/appwrite/pull/4429) +- Fix attribute and index deletion when deleting a collection [#4429](https://github.com/appwrite/appwrite/pull/4429) # Version 1.0.2 ## Bugs diff --git a/README-CN.md b/README-CN.md index 4258552da7..eaada5a34b 100644 --- a/README-CN.md +++ b/README-CN.md @@ -62,7 +62,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.0.2 + appwrite/appwrite:1.0.3 ``` ### Windows @@ -74,7 +74,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.0.2 + appwrite/appwrite:1.0.3 ``` #### PowerShell @@ -84,7 +84,7 @@ docker run -it --rm , --volume /var/run/docker.sock:/var/run/docker.sock , --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw , --entrypoint="install" , - appwrite/appwrite:1.0.2 + appwrite/appwrite:1.0.3 ``` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 diff --git a/README.md b/README.md index 1bd62d61b9..0a56c48073 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.0.2 + appwrite/appwrite:1.0.3 ``` ### Windows @@ -87,7 +87,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.0.2 + appwrite/appwrite:1.0.3 ``` #### PowerShell @@ -97,7 +97,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.0.2 + appwrite/appwrite:1.0.3 ``` Once the Docker installation completes, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after installation completes. diff --git a/app/init.php b/app/init.php index 4c8a36cf99..a19492394b 100644 --- a/app/init.php +++ b/app/init.php @@ -95,7 +95,7 @@ const APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT = 60; // Default maximum write rate pe const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 501; -const APP_VERSION_STABLE = '1.0.2'; +const APP_VERSION_STABLE = '1.0.3'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip'; diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index d90f90e975..c87c907bf0 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -44,7 +44,7 @@ abstract class Migration '1.0.0-RC1' => 'V15', '1.0.0' => 'V15', '1.0.1' => 'V15', - '1.0.2' => 'V15' + '1.0.3' => 'V15' ]; /**