From e88aebd4ad5603cc623b91f93e0d3fb0ddb2c49b Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Sat, 17 May 2025 00:05:11 +0530 Subject: [PATCH] added upgrade limit for db --- src/Appwrite/Platform/Tasks/Install.php | 4 ++++ src/Appwrite/Platform/Tasks/Upgrade.php | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 7d13973003..1ac2fbac5f 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -181,6 +181,10 @@ class Install extends Action continue; } + if ($var['name'] === '_APP_DB_SCHEME' && $data !== false) { + continue; + } + $input[$var['name']] = Console::confirm($var['question'] . ' (default: \'' . $var['default'] . '\')'); if (empty($input[$var['name']])) { diff --git a/src/Appwrite/Platform/Tasks/Upgrade.php b/src/Appwrite/Platform/Tasks/Upgrade.php index 5f4b625462..ecf71d27a1 100644 --- a/src/Appwrite/Platform/Tasks/Upgrade.php +++ b/src/Appwrite/Platform/Tasks/Upgrade.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Tasks; use Utopia\CLI\Console; +use Utopia\System\System; use Utopia\Validator\Boolean; use Utopia\Validator\Text; @@ -23,8 +24,8 @@ class Upgrade extends Install ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) - ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); + ->param('database', 'mariadb', new Text(length: 0), 'Database to use (mariadb|postgresql)', true) + ->callback($this->action(...)); } public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void @@ -40,6 +41,7 @@ class Upgrade extends Install Console::log(' └── docker-compose.yml'); Console::exit(1); } + $database = System::getEnv('_APP_DB_SCHEME', 'mariadb'); parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database); } }