From 2babf7f59df081ef24f3e57158dfe685445cc69e Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 18 Apr 2024 10:08:19 +0300 Subject: [PATCH] 1.5.x version --- composer.lock | 12 ++++++------ src/Appwrite/Platform/Workers/Databases.php | 13 +++++-------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/composer.lock b/composer.lock index 15fbde266b..37149d8e23 100644 --- a/composer.lock +++ b/composer.lock @@ -2731,16 +2731,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.37.10", + "version": "0.37.12", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "d875e74c2d64e11c0f787531cea0b3b3703f476a" + "reference": "882881934e8014b2135590e7ea5f402ab4513c38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/d875e74c2d64e11c0f787531cea0b3b3703f476a", - "reference": "d875e74c2d64e11c0f787531cea0b3b3703f476a", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/882881934e8014b2135590e7ea5f402ab4513c38", + "reference": "882881934e8014b2135590e7ea5f402ab4513c38", "shasum": "" }, "require": { @@ -2776,9 +2776,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.37.10" + "source": "https://github.com/appwrite/sdk-generator/tree/0.37.12" }, - "time": "2024-04-17T07:55:05+00:00" + "time": "2024-04-17T19:14:43+00:00" }, { "name": "doctrine/deprecations", diff --git a/src/Appwrite/Platform/Workers/Databases.php b/src/Appwrite/Platform/Workers/Databases.php index 6cb1bf3c28..0d1ae14890 100644 --- a/src/Appwrite/Platform/Workers/Databases.php +++ b/src/Appwrite/Platform/Workers/Databases.php @@ -522,18 +522,15 @@ class Databases extends Action Query::equal('databaseInternalId', [$databaseInternalId]), Query::equal('type', [Database::VAR_RELATIONSHIP]), Query::notEqual('collectionInternalId', $collectionInternalId), - Query::contains('options', ['"relatedCollection":"'. $collectionId .'"']), // Comment in Version < 1.5 + Query::contains('options', ['"relatedCollection":"'. $collectionId .'"']), Query::limit(PHP_INT_MAX) ]); foreach ($attributes as $attribute) { - $options = $attribute->getAttribute('options', []); - if($options['relatedCollection'] === $collectionId) { // Remove if using contains query above - $dbForProject->deleteDocument('attributes', $attribute->getId()); - Console::success('Deleted document "' . $attribute->getId() . '" related collection successfully'); - $dbForProject->purgeCachedDocument('database_' . $databaseInternalId, $attribute->getAttribute('collectionId')); - $dbForProject->purgeCachedCollection('database_' . $databaseInternalId . '_collection_' . $attribute->getAttribute('collectionInternalId')); - } + $dbForProject->deleteDocument('attributes', $attribute->getId()); + Console::success('Deleted document "' . $attribute->getId() . '" related collection successfully'); + $dbForProject->purgeCachedDocument('database_' . $databaseInternalId, $attribute->getAttribute('collectionId')); + $dbForProject->purgeCachedCollection('database_' . $databaseInternalId . '_collection_' . $attribute->getAttribute('collectionInternalId')); } $dbForProject->deleteCollection('database_' . $databaseInternalId . '_collection_' . $collection->getInternalId());