From cef4d899e39fd2c119ff319fda01d394e535dd76 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 10 Mar 2026 14:38:14 +0530 Subject: [PATCH] Add LEGACY constant and update database type references - Introduced a new constant `LEGACY` in Constants.php. - Updated `databaseType` in Action classes to use `LEGACY` instead of `TABLESDB`. - Cleaned up duplicate parameter definition in Create.php for transactionId. --- src/Appwrite/Platform/Modules/Databases/Constants.php | 1 + .../Databases/Http/Databases/Collections/Action.php | 2 +- .../Http/Databases/Collections/Documents/Create.php | 3 +-- .../Databases/Http/Databases/Transactions/Action.php | 7 +++---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Constants.php b/src/Appwrite/Platform/Modules/Databases/Constants.php index 6ed373ef77..6bfbcae938 100644 --- a/src/Appwrite/Platform/Modules/Databases/Constants.php +++ b/src/Appwrite/Platform/Modules/Databases/Constants.php @@ -23,6 +23,7 @@ const DOCUMENTS = 'document'; const ATTRIBUTES = 'attribute'; const COLLECTIONS = 'collection'; +const LEGACY = 'legacy'; const TABLESDB = 'tablesdb'; const DOCUMENTSDB = 'documentsdb'; const VECTORDB = 'vectordb'; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Action.php index 528fd92027..b0574eff8b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Action.php @@ -15,7 +15,7 @@ abstract class Action extends UtopiaAction */ private ?string $context = COLLECTIONS; - private ?string $databaseType = TABLESDB; + private ?string $databaseType = LEGACY; /** * Get the response model used in the SDK and HTTP responses. diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php index 292329662d..4960273631 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php @@ -110,8 +110,7 @@ class Create extends Action new Parameter('databaseId', optional: false), new Parameter('collectionId', optional: false), new Parameter('documents', optional: false), - new Parameter('transactionId', optional: true), - new Parameter('transactionId', optional: true), + new Parameter('transactionId', optional: true) ], deprecated: new Deprecated( since: '1.8.0', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Action.php index 033446a00c..5863d3f8b9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Action.php @@ -10,7 +10,7 @@ abstract class Action extends DatabasesAction * The current API context (either 'table' or 'collection'). */ private ?string $context = COLLECTIONS; - private ?string $databaseType = TABLESDB; + private ?string $databaseType = LEGACY; public function getDatabaseType(): string { @@ -19,7 +19,7 @@ abstract class Action extends DatabasesAction protected function getDatabasesOperationWriteMetric(): string { - if ($this->databaseType === DATABASE_TYPE_LEGACY || $this->databaseType === TABLESDB) { + if ($this->databaseType === LEGACY || $this->databaseType === TABLESDB) { return METRIC_DATABASES_OPERATIONS_WRITES; } return $this->databaseType.'.'.METRIC_DATABASES_OPERATIONS_WRITES; @@ -27,7 +27,7 @@ abstract class Action extends DatabasesAction } protected function getDatabasesIdOperationWriteMetric(): string { - if ($this->databaseType === DATABASE_TYPE_LEGACY || $this->databaseType === TABLESDB) { + if ($this->databaseType === LEGACY || $this->databaseType === TABLESDB) { return METRIC_DATABASE_ID_OPERATIONS_WRITES; } return $this->databaseType.'.'.METRIC_DATABASE_ID_OPERATIONS_WRITES; @@ -36,7 +36,6 @@ abstract class Action extends DatabasesAction public function setHttpPath(string $path): DatabasesAction { switch (true) { - // TODO: set the getDatabaseType() from each database group instead of path matching case str_contains($path, '/tablesdb'): $this->context = TABLES; $this->databaseType = TABLESDB;