From 3281b8bbd4b96b5c3750b25b2fc6853785eb7963 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 3 Oct 2022 15:06:44 +0000 Subject: [PATCH 01/12] Add meaningful Phone number examples to specs --- src/Appwrite/Specification/Format/OpenAPI3.php | 5 +++++ src/Appwrite/Specification/Format/Swagger2.php | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Specification/Format/OpenAPI3.php b/src/Appwrite/Specification/Format/OpenAPI3.php index 9aa25fcde7..fb7208c569 100644 --- a/src/Appwrite/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/Specification/Format/OpenAPI3.php @@ -368,6 +368,11 @@ class OpenAPI3 extends Format $node['schema']['format'] = 'password'; $node['schema']['x-example'] = 'password'; break; + case 'Appwrite\Auth\Validator\Phone': + $node['schema']['type'] = $validator->getType(); + $node['schema']['format'] = 'phone'; + $node['schema']['x-example'] = '+12065550100'; // In the US, 555 is reserved like example.com + break; case 'Utopia\Validator\Range': /** @var \Utopia\Validator\Range $validator */ $node['schema']['type'] = $validator->getType() === Validator::TYPE_FLOAT ? 'number' : $validator->getType(); diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index fc296b17a2..49a5a2757c 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -305,7 +305,7 @@ class Swagger2 extends Format case 'Appwrite\Network\Validator\Email': $node['type'] = $validator->getType(); $node['format'] = 'email'; - $node['x-example'] = 'email@example.com'; + $node['x-example'] = 'email@examples.com'; break; case 'Appwrite\Network\Validator\URL': $node['type'] = $validator->getType(); @@ -365,6 +365,11 @@ class Swagger2 extends Format $node['format'] = 'password'; $node['x-example'] = 'password'; break; + case 'Appwrite\Auth\Validator\Phone': + $node['type'] = $validator->getType(); + $node['format'] = 'phone'; + $node['x-example'] = '+12065550100'; + break; case 'Utopia\Validator\Range': /** @var \Utopia\Validator\Range $validator */ $node['type'] = $validator->getType() === Validator::TYPE_FLOAT ? 'number' : $validator->getType(); From 207941558f361d645fc355cdee18e66b125ee838 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 3 Oct 2022 15:13:04 +0000 Subject: [PATCH 02/12] fix typo in email examples --- src/Appwrite/Specification/Format/Swagger2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index 49a5a2757c..6eb27a11aa 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -305,7 +305,7 @@ class Swagger2 extends Format case 'Appwrite\Network\Validator\Email': $node['type'] = $validator->getType(); $node['format'] = 'email'; - $node['x-example'] = 'email@examples.com'; + $node['x-example'] = 'email@example.com'; break; case 'Appwrite\Network\Validator\URL': $node['type'] = $validator->getType(); From 12b1ecfcf9145f31b3f1732a4ed9cb0f9fcf10a3 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 4 Oct 2022 17:04:42 +0530 Subject: [PATCH 03/12] feat: mysql support --- app/config/collections.php | 338 +++++++++++++++--------------- app/controllers/api/databases.php | 2 +- app/init.php | 6 +- app/realtime.php | 8 +- app/tasks/maintenance.php | 4 +- app/tasks/migrate.php | 6 +- app/tasks/usage.php | 4 +- src/Appwrite/Resque/Worker.php | 4 +- 8 files changed, 186 insertions(+), 186 deletions(-) diff --git a/app/config/collections.php b/app/config/collections.php index d8f65da788..334c1ae406 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -2076,7 +2076,7 @@ $collections = [ '$id' => ID::custom('name'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 2048, + 'size' => 16384, 'signed' => true, 'required' => false, 'default' => null, @@ -2097,7 +2097,7 @@ $collections = [ '$id' => ID::custom('runtime'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 2048, + 'size' => 16384, 'signed' => true, 'required' => false, 'default' => null, @@ -2209,65 +2209,65 @@ $collections = [ '$id' => ID::custom('_key_search'), 'type' => Database::INDEX_FULLTEXT, 'attributes' => ['search'], - 'lengths' => [2048], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_name'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['name'], - 'lengths' => [2048], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_enabled'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['enabled'], 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_runtime'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['runtime'], - 'lengths' => [2048], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_deployment'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['deployment'], - 'lengths' => [Database::LENGTH_KEY], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_schedule'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['schedule'], - 'lengths' => [128], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_scheduleNext'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['scheduleNext'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_schedulePrevious'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['schedulePrevious'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_timeout'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['timeout'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], + 'orders' => [], ], + // [ + // '$id' => ID::custom('_key_name'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['name'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_enabled'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['enabled'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_runtime'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['runtime'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_deployment'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['deployment'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_schedule'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['schedule'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_scheduleNext'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['scheduleNext'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_schedulePrevious'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['schedulePrevious'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_timeout'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['timeout'], + // 'lengths' => [], + // 'orders' => [], + // ], ], ], @@ -2314,7 +2314,7 @@ $collections = [ '$id' => ID::custom('entrypoint'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 2048, + 'size' => 16384, 'signed' => true, 'required' => false, 'default' => null, @@ -2324,7 +2324,7 @@ $collections = [ '$id' => ID::custom('path'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 2048, + 'size' => 16384, 'signed' => true, 'required' => false, 'default' => null, @@ -2399,55 +2399,55 @@ $collections = [ ] ], 'indexes' => [ - [ - '$id' => ID::custom('_key_resource'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['resourceId'], - 'lengths' => [Database::LENGTH_KEY], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_resource_type'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['resourceType'], - 'lengths' => [Database::LENGTH_KEY], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_search'), - 'type' => Database::INDEX_FULLTEXT, - 'attributes' => ['search'], - 'lengths' => [], - 'orders' => [], - ], - [ - '$id' => ID::custom('_key_entrypoint'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['entrypoint'], - 'lengths' => [2048], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_size'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['size'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_buildId'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['buildId'], - 'lengths' => [Database::LENGTH_KEY], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_activate'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['activate'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], + // [ + // '$id' => ID::custom('_key_resource'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['resourceId'], + // 'lengths' => [Database::LENGTH_KEY], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_resource_type'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['resourceType'], + // 'lengths' => [Database::LENGTH_KEY], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_search'), + // 'type' => Database::INDEX_FULLTEXT, + // 'attributes' => ['search'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_entrypoint'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['entrypoint'], + // 'lengths' => [Database::LENGTH_KEY], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_size'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['size'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_buildId'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['buildId'], + // 'lengths' => [Database::LENGTH_KEY], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_activate'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['activate'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], ], ], @@ -2935,62 +2935,62 @@ $collections = [ ], ], 'indexes' => [ - [ - '$id' => ID::custom('_fulltext_name'), - 'type' => Database::INDEX_FULLTEXT, - 'attributes' => ['name'], - 'lengths' => [1024], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_search'), - 'type' => Database::INDEX_FULLTEXT, - 'attributes' => ['search'], - 'lengths' => [2048], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_enabled'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['enabled'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_name'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['name'], - 'lengths' => [128], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_fileSecurity'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['fileSecurity'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_maximumFileSize'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['maximumFileSize'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_encryption'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['encryption'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_antivirus'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['antivirus'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], + // [ + // '$id' => ID::custom('_fulltext_name'), + // 'type' => Database::INDEX_FULLTEXT, + // 'attributes' => ['name'], + // 'lengths' => [1024], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_search'), + // 'type' => Database::INDEX_FULLTEXT, + // 'attributes' => ['search'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_enabled'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['enabled'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_name'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['name'], + // 'lengths' => [128], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_fileSecurity'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['fileSecurity'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_maximumFileSize'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['maximumFileSize'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_encryption'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['encryption'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_antivirus'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['antivirus'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], ] ], @@ -3383,7 +3383,7 @@ $collections = [ '$id' => ID::custom('_key_search'), 'type' => Database::INDEX_FULLTEXT, 'attributes' => ['search'], - 'lengths' => [2048], + 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], [ @@ -3397,14 +3397,14 @@ $collections = [ '$id' => ID::custom('_key_name'), 'type' => Database::INDEX_KEY, 'attributes' => ['name'], - 'lengths' => [2048], + 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], [ '$id' => ID::custom('_key_signature'), 'type' => Database::INDEX_KEY, 'attributes' => ['signature'], - 'lengths' => [2048], + 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], [ diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index e2acb30772..22f1644de3 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -20,7 +20,7 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\DateTime; use Utopia\Database\Query; -use Utopia\Database\Adapter\MariaDB; +use Utopia\Database\Adapter\MySQL; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Permissions; diff --git a/app/init.php b/app/init.php index 3c9f785f9d..f55984512d 100644 --- a/app/init.php +++ b/app/init.php @@ -52,7 +52,7 @@ use MaxMind\Db\Reader; use PHPMailer\PHPMailer\PHPMailer; use Utopia\Cache\Adapter\Redis as RedisCache; use Utopia\Cache\Cache; -use Utopia\Database\Adapter\MariaDB; +use Utopia\Database\Adapter\MySQL; use Utopia\Database\Document; use Utopia\Database\Database; use Utopia\Database\Validator\Structure; @@ -928,7 +928,7 @@ App::setResource('console', function () { App::setResource('dbForProject', function ($db, $cache, Document $project) { $cache = new Cache(new RedisCache($cache)); - $database = new Database(new MariaDB($db), $cache); + $database = new Database(new MySQL($db), $cache); $database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $database->setNamespace("_{$project->getInternalId()}"); @@ -938,7 +938,7 @@ App::setResource('dbForProject', function ($db, $cache, Document $project) { App::setResource('dbForConsole', function ($db, $cache) { $cache = new Cache(new RedisCache($cache)); - $database = new Database(new MariaDB($db), $cache); + $database = new Database(new MySQL($db), $cache); $database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $database->setNamespace('_console'); diff --git a/app/realtime.php b/app/realtime.php index be87c3d6e6..8004677414 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -20,7 +20,7 @@ use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Cache\Adapter\Redis as RedisCache; use Utopia\Cache\Cache; -use Utopia\Database\Adapter\MariaDB; +use Utopia\Database\Adapter\MySQL; use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; @@ -107,7 +107,7 @@ function getDatabase(Registry &$register, string $namespace) $redis = $register->get('redisPool')->get(); $cache = new Cache(new RedisCache($redis)); - $database = new Database(new MariaDB($db), $cache); + $database = new Database(new MySQL($db), $cache); $database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $database->setNamespace($namespace); @@ -382,7 +382,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $console = $app->getResource('console'); $cache = new Cache(new RedisCache($redis)); - $database = new Database(new MariaDB($db), $cache); + $database = new Database(new MySQL($db), $cache); $database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $database->setNamespace("_{$project->getInternalId()}"); @@ -489,7 +489,7 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re $redis = $register->get('redisPool')->get(); $cache = new Cache(new RedisCache($redis)); - $database = new Database(new MariaDB($db), $cache); + $database = new Database(new MySQL($db), $cache); $database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $database->setNamespace("_console"); $projectId = $realtime->connections[$connection]['projectId']; diff --git a/app/tasks/maintenance.php b/app/tasks/maintenance.php index 42b5ed00dc..b8ad5adcbd 100644 --- a/app/tasks/maintenance.php +++ b/app/tasks/maintenance.php @@ -9,7 +9,7 @@ use Appwrite\Event\Delete; use Utopia\App; use Utopia\Cache\Cache; use Utopia\CLI\Console; -use Utopia\Database\Adapter\MariaDB; +use Utopia\Database\Adapter\MySQL; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Cache\Adapter\Redis as RedisCache; @@ -26,7 +26,7 @@ function getConsoleDB(): Database try { $attempts++; $cache = new Cache(new RedisCache($register->get('cache'))); - $database = new Database(new MariaDB($register->get('db')), $cache); + $database = new Database(new MySQL($register->get('db')), $cache); $database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $database->setNamespace('_console'); // Main DB diff --git a/app/tasks/migrate.php b/app/tasks/migrate.php index f0ab71a964..c30cd33459 100644 --- a/app/tasks/migrate.php +++ b/app/tasks/migrate.php @@ -7,7 +7,7 @@ use Appwrite\Migration\Migration; use Utopia\App; use Utopia\Cache\Cache; use Utopia\Cache\Adapter\Redis as RedisCache; -use Utopia\Database\Adapter\MariaDB; +use Utopia\Database\Adapter\MySQL; use Utopia\Database\Database; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; @@ -33,10 +33,10 @@ $cli $redis->flushAll(); $cache = new Cache(new RedisCache($redis)); - $projectDB = new Database(new MariaDB($db), $cache); + $projectDB = new Database(new MySQL($db), $cache); $projectDB->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); - $consoleDB = new Database(new MariaDB($db), $cache); + $consoleDB = new Database(new MySQL($db), $cache); $consoleDB->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $consoleDB->setNamespace('_project_console'); diff --git a/app/tasks/usage.php b/app/tasks/usage.php index 48876557a8..34519bcce4 100644 --- a/app/tasks/usage.php +++ b/app/tasks/usage.php @@ -12,7 +12,7 @@ use Utopia\App; use Utopia\Cache\Adapter\Redis as RedisCache; use Utopia\Cache\Cache; use Utopia\CLI\Console; -use Utopia\Database\Adapter\MariaDB; +use Utopia\Database\Adapter\MySQL; use Utopia\Database\Database as UtopiaDatabase; use Utopia\Database\Validator\Authorization; use Utopia\Registry\Registry; @@ -34,7 +34,7 @@ function getDatabase(Registry &$register, string $namespace): UtopiaDatabase $redis = $register->get('cache'); $cache = new Cache(new RedisCache($redis)); - $database = new UtopiaDatabase(new MariaDB($db), $cache); + $database = new UtopiaDatabase(new MySQL($db), $cache); $database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $database->setNamespace($namespace); diff --git a/src/Appwrite/Resque/Worker.php b/src/Appwrite/Resque/Worker.php index 40adc3e52e..d7f0872912 100644 --- a/src/Appwrite/Resque/Worker.php +++ b/src/Appwrite/Resque/Worker.php @@ -7,7 +7,7 @@ use Utopia\Cache\Cache; use Utopia\Cache\Adapter\Redis as RedisCache; use Utopia\CLI\Console; use Utopia\Database\Database; -use Utopia\Database\Adapter\MariaDB; +use Utopia\Database\Adapter\MySQL; use Utopia\Storage\Device; use Utopia\Storage\Storage; use Utopia\Storage\Device\Local; @@ -221,7 +221,7 @@ abstract class Worker try { $attempts++; $cache = new Cache(new RedisCache($register->get('cache'))); - $database = new Database(new MariaDB($register->get('db')), $cache); + $database = new Database(new MySQL($register->get('db')), $cache); $database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $database->setNamespace($namespace); // Main DB From 1a9c4e37561868fafb801b6201eddd21040c8254 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 6 Oct 2022 18:41:15 +0530 Subject: [PATCH 04/12] fix: mysql indexes issue --- app/config/collections.php | 114 ++++++++++++++++++------------------- docker-compose.yml | 90 ++++++++++++++++++++--------- 2 files changed, 120 insertions(+), 84 deletions(-) diff --git a/app/config/collections.php b/app/config/collections.php index 334c1ae406..4297721dbb 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -2896,7 +2896,7 @@ $collections = [ '$id' => 'compression', 'type' => Database::VAR_STRING, 'signed' => true, - 'size' => 10, + 'size' => 128, 'format' => '', 'filters' => [], 'required' => true, @@ -3379,62 +3379,62 @@ $collections = [ ], ], 'indexes' => [ - [ - '$id' => ID::custom('_key_search'), - 'type' => Database::INDEX_FULLTEXT, - 'attributes' => ['search'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_bucket'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['bucketId'], - 'lengths' => [Database::LENGTH_KEY], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_name'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['name'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_signature'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['signature'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_mimeType'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['mimeType'], - 'lengths' => [127], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_sizeOriginal'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['sizeOriginal'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_chunksTotal'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['chunksTotal'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], - [ - '$id' => ID::custom('_key_chunksUploaded'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['chunksUploaded'], - 'lengths' => [], - 'orders' => [Database::ORDER_ASC], - ], + // [ + // '$id' => ID::custom('_key_search'), + // 'type' => Database::INDEX_FULLTEXT, + // 'attributes' => ['search'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_bucket'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['bucketId'], + // 'lengths' => [Database::LENGTH_KEY], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_name'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['name'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_signature'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['signature'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_mimeType'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['mimeType'], + // 'lengths' => [127], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_sizeOriginal'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['sizeOriginal'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_chunksTotal'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['chunksTotal'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], + // [ + // '$id' => ID::custom('_key_chunksUploaded'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['chunksUploaded'], + // 'lengths' => [], + // 'orders' => [Database::ORDER_ASC], + // ], ] ], diff --git a/docker-compose.yml b/docker-compose.yml index 79a8d218fa..bd30de3e9f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,30 +10,6 @@ x-logging: &x-logging max-file: '5' max-size: '10m' -x-env-storage: &x-env-storage |- - _APP_STORAGE_DEVICE - _APP_STORAGE_S3_ACCESS_KEY - _APP_STORAGE_S3_SECRET - _APP_STORAGE_S3_REGION - _APP_STORAGE_S3_BUCKET - _APP_STORAGE_DO_SPACES_ACCESS_KEY - _APP_STORAGE_DO_SPACES_SECRET - _APP_STORAGE_DO_SPACES_REGION - _APP_STORAGE_DO_SPACES_BUCKET - _APP_STORAGE_BACKBLAZE_ACCESS_KEY - _APP_STORAGE_BACKBLAZE_SECRET - _APP_STORAGE_BACKBLAZE_REGION - _APP_STORAGE_BACKBLAZE_BUCKET - _APP_STORAGE_DO_SPACES_BUCKET - _APP_STORAGE_LINODE_ACCESS_KEY - _APP_STORAGE_LINODE_SECRET - _APP_STORAGE_LINODE_REGION - _APP_STORAGE_LINODE_BUCKET - _APP_STORAGE_WASABI_ACCESS_KEY - _APP_STORAGE_WASABI_SECRET - _APP_STORAGE_WASABI_REGION - _APP_STORAGE_WASABI_BUCKET - version: '3' services: @@ -154,7 +130,27 @@ services: - _APP_STORAGE_ANTIVIRUS - _APP_STORAGE_ANTIVIRUS_HOST - _APP_STORAGE_ANTIVIRUS_PORT - - *x-env-storage + - _APP_STORAGE_DEVICE + - _APP_STORAGE_S3_ACCESS_KEY + - _APP_STORAGE_S3_SECRET + - _APP_STORAGE_S3_REGION + - _APP_STORAGE_S3_BUCKET + - _APP_STORAGE_DO_SPACES_ACCESS_KEY + - _APP_STORAGE_DO_SPACES_SECRET + - _APP_STORAGE_DO_SPACES_REGION + - _APP_STORAGE_DO_SPACES_BUCKET + - _APP_STORAGE_BACKBLAZE_ACCESS_KEY + - _APP_STORAGE_BACKBLAZE_SECRET + - _APP_STORAGE_BACKBLAZE_REGION + - _APP_STORAGE_BACKBLAZE_BUCKET + - _APP_STORAGE_LINODE_ACCESS_KEY + - _APP_STORAGE_LINODE_SECRET + - _APP_STORAGE_LINODE_REGION + - _APP_STORAGE_LINODE_BUCKET + - _APP_STORAGE_WASABI_ACCESS_KEY + - _APP_STORAGE_WASABI_SECRET + - _APP_STORAGE_WASABI_REGION + - _APP_STORAGE_WASABI_BUCKET - _APP_FUNCTIONS_SIZE_LIMIT - _APP_FUNCTIONS_TIMEOUT - _APP_FUNCTIONS_BUILD_TIMEOUT @@ -311,7 +307,27 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS - - *x-env-storage + - _APP_STORAGE_DEVICE + - _APP_STORAGE_S3_ACCESS_KEY + - _APP_STORAGE_S3_SECRET + - _APP_STORAGE_S3_REGION + - _APP_STORAGE_S3_BUCKET + - _APP_STORAGE_DO_SPACES_ACCESS_KEY + - _APP_STORAGE_DO_SPACES_SECRET + - _APP_STORAGE_DO_SPACES_REGION + - _APP_STORAGE_DO_SPACES_BUCKET + - _APP_STORAGE_BACKBLAZE_ACCESS_KEY + - _APP_STORAGE_BACKBLAZE_SECRET + - _APP_STORAGE_BACKBLAZE_REGION + - _APP_STORAGE_BACKBLAZE_BUCKET + - _APP_STORAGE_LINODE_ACCESS_KEY + - _APP_STORAGE_LINODE_SECRET + - _APP_STORAGE_LINODE_REGION + - _APP_STORAGE_LINODE_BUCKET + - _APP_STORAGE_WASABI_ACCESS_KEY + - _APP_STORAGE_WASABI_SECRET + - _APP_STORAGE_WASABI_REGION + - _APP_STORAGE_WASABI_BUCKET - _APP_LOGGING_PROVIDER - _APP_LOGGING_CONFIG - _APP_EXECUTOR_SECRET @@ -488,7 +504,27 @@ services: - OPEN_RUNTIMES_NETWORK - _APP_LOGGING_PROVIDER - _APP_LOGGING_CONFIG - - *x-env-storage + - _APP_STORAGE_DEVICE + - _APP_STORAGE_S3_ACCESS_KEY + - _APP_STORAGE_S3_SECRET + - _APP_STORAGE_S3_REGION + - _APP_STORAGE_S3_BUCKET + - _APP_STORAGE_DO_SPACES_ACCESS_KEY + - _APP_STORAGE_DO_SPACES_SECRET + - _APP_STORAGE_DO_SPACES_REGION + - _APP_STORAGE_DO_SPACES_BUCKET + - _APP_STORAGE_BACKBLAZE_ACCESS_KEY + - _APP_STORAGE_BACKBLAZE_SECRET + - _APP_STORAGE_BACKBLAZE_REGION + - _APP_STORAGE_BACKBLAZE_BUCKET + - _APP_STORAGE_LINODE_ACCESS_KEY + - _APP_STORAGE_LINODE_SECRET + - _APP_STORAGE_LINODE_REGION + - _APP_STORAGE_LINODE_BUCKET + - _APP_STORAGE_WASABI_ACCESS_KEY + - _APP_STORAGE_WASABI_SECRET + - _APP_STORAGE_WASABI_REGION + - _APP_STORAGE_WASABI_BUCKET - DOCKERHUB_PULL_USERNAME - DOCKERHUB_PULL_PASSWORD From 1b776f7fdc13feb10b2e7402653a21655d2818d3 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 20 Oct 2022 23:59:00 +0300 Subject: [PATCH 05/12] some changes --- .env | 8 +-- app/config/collections.php | 116 ++++++++++++++++++------------------- composer.json | 4 +- composer.lock | 94 +++++++++++++++--------------- docker-compose.yml | 1 + 5 files changed, 112 insertions(+), 111 deletions(-) diff --git a/.env b/.env index 227ea10676..55e32cb722 100644 --- a/.env +++ b/.env @@ -17,11 +17,11 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= -_APP_DB_HOST=mariadb -_APP_DB_PORT=3306 +_APP_DB_HOST=db-mysql-fra1-shmuel-test-do-user-10204879-0.b.db.ondigitalocean.com +_APP_DB_PORT=25060 _APP_DB_SCHEMA=appwrite -_APP_DB_USER=user -_APP_DB_PASS=password +_APP_DB_USER=doadmin +_APP_DB_PASS=AVNS_LjyH2XQ_tKwGwira3tn _APP_DB_ROOT_PASS=rootsecretpassword _APP_STORAGE_DEVICE=Local _APP_STORAGE_S3_ACCESS_KEY= diff --git a/app/config/collections.php b/app/config/collections.php index 4297721dbb..f9f1d78148 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -2076,7 +2076,7 @@ $collections = [ '$id' => ID::custom('name'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 16384, + 'size' => 2048, 'signed' => true, 'required' => false, 'default' => null, @@ -2097,7 +2097,7 @@ $collections = [ '$id' => ID::custom('runtime'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 16384, + 'size' => 2048, 'signed' => true, 'required' => false, 'default' => null, @@ -2212,62 +2212,62 @@ $collections = [ 'lengths' => [], 'orders' => [], ], - // [ - // '$id' => ID::custom('_key_name'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['name'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_enabled'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['enabled'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_runtime'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['runtime'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_deployment'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['deployment'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_schedule'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['schedule'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_scheduleNext'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['scheduleNext'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_schedulePrevious'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['schedulePrevious'], - // 'lengths' => [], - // 'orders' => [], - // ], - // [ - // '$id' => ID::custom('_key_timeout'), - // 'type' => Database::INDEX_KEY, - // 'attributes' => ['timeout'], - // 'lengths' => [], - // 'orders' => [], - // ], + [ + '$id' => ID::custom('_key_name'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['name'], + 'lengths' => [700], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_enabled'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['enabled'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_runtime'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['runtime'], + 'lengths' => [700], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_deployment'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['deployment'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_schedule'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['schedule'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_scheduleNext'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['scheduleNext'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_schedulePrevious'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['schedulePrevious'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_timeout'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['timeout'], + 'lengths' => [], + 'orders' => [], + ], ], ], diff --git a/composer.json b/composer.json index 973aec8539..7cefd70e9e 100644 --- a/composer.json +++ b/composer.json @@ -48,10 +48,10 @@ "utopia-php/abuse": "0.13.*", "utopia-php/analytics": "0.2.*", "utopia-php/audit": "0.14.*", - "utopia-php/cache": "0.6.*", + "utopia-php/cache": "0.7.*", "utopia-php/cli": "0.13.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.25.*", + "utopia-php/database": "dev-mysql-varchar-index-length as 0.25.7", "utopia-php/locale": "0.4.*", "utopia-php/registry": "0.5.*", "utopia-php/preloader": "0.2.*", diff --git a/composer.lock b/composer.lock index 9ec0ea3197..5ae81fbd36 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "568151395a8877f87d9bdce048adc2dc", + "content-hash": "f0c0b6f8c2a3d8c16a7357f57c2730cc", "packages": [ { "name": "adhocore/jwt", @@ -1903,24 +1903,26 @@ }, { "name": "utopia-php/cache", - "version": "0.6.1", + "version": "0.7.0", "source": { "type": "git", "url": "https://github.com/utopia-php/cache.git", - "reference": "9889235a6d3da6cbb1f435201529da4d27c30e79" + "reference": "cd53431242c88299daea2589e21322abe97682cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/cache/zipball/9889235a6d3da6cbb1f435201529da4d27c30e79", - "reference": "9889235a6d3da6cbb1f435201529da4d27c30e79", + "url": "https://api.github.com/repos/utopia-php/cache/zipball/cd53431242c88299daea2589e21322abe97682cc", + "reference": "cd53431242c88299daea2589e21322abe97682cc", "shasum": "" }, "require": { "ext-json": "*", + "ext-memcached": "*", "ext-redis": "*", "php": ">=8.0" }, "require-dev": { + "laravel/pint": "1.2.*", "phpunit/phpunit": "^9.3", "vimeo/psalm": "4.13.1" }, @@ -1934,12 +1936,6 @@ "license": [ "MIT" ], - "authors": [ - { - "name": "Eldad Fux", - "email": "eldad@appwrite.io" - } - ], "description": "A simple cache library to manage application cache storing, loading and purging", "keywords": [ "cache", @@ -1950,9 +1946,9 @@ ], "support": { "issues": "https://github.com/utopia-php/cache/issues", - "source": "https://github.com/utopia-php/cache/tree/0.6.1" + "source": "https://github.com/utopia-php/cache/tree/0.7.0" }, - "time": "2022-08-10T08:12:46+00:00" + "time": "2022-10-16T06:04:12+00:00" }, { "name": "utopia-php/cli", @@ -2060,16 +2056,16 @@ }, { "name": "utopia-php/database", - "version": "0.25.4", + "version": "dev-mysql-varchar-index-length", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "2883de82eee99e5744bf6e4123095a530c48a194" + "reference": "6dfc74188e24ffa600f2e0edc505a2f168e8cc04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/2883de82eee99e5744bf6e4123095a530c48a194", - "reference": "2883de82eee99e5744bf6e4123095a530c48a194", + "url": "https://api.github.com/repos/utopia-php/database/zipball/6dfc74188e24ffa600f2e0edc505a2f168e8cc04", + "reference": "6dfc74188e24ffa600f2e0edc505a2f168e8cc04", "shasum": "" }, "require": { @@ -2078,7 +2074,7 @@ "ext-redis": "*", "mongodb/mongodb": "1.8.0", "php": ">=8.0", - "utopia-php/cache": "0.6.*", + "utopia-php/cache": "0.7.*", "utopia-php/framework": "0.*.*" }, "require-dev": { @@ -2098,16 +2094,6 @@ "license": [ "MIT" ], - "authors": [ - { - "name": "Eldad Fux", - "email": "eldad@appwrite.io" - }, - { - "name": "Brandon Leckemby", - "email": "brandon@appwrite.io" - } - ], "description": "A simple library to manage application persistency using multiple database adapters", "keywords": [ "database", @@ -2118,9 +2104,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.25.4" + "source": "https://github.com/utopia-php/database/tree/mysql-varchar-index-length" }, - "time": "2022-09-14T06:22:33+00:00" + "time": "2022-10-20T19:41:52+00:00" }, { "name": "utopia-php/domains", @@ -3419,25 +3405,30 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.1", + "version": "1.6.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" + "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" }, "type": "library", "extra": { @@ -3463,9 +3454,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" }, - "time": "2022-03-15T21:29:03+00:00" + "time": "2022-10-14T12:47:21+00:00" }, { "name": "phpspec/prophecy", @@ -5283,16 +5274,16 @@ }, { "name": "twig/twig", - "version": "v3.4.2", + "version": "v3.4.3", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077" + "reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077", - "reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/c38fd6b0b7f370c198db91ffd02e23b517426b58", + "reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58", "shasum": "" }, "require": { @@ -5343,7 +5334,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.4.2" + "source": "https://github.com/twigphp/Twig/tree/v3.4.3" }, "funding": [ { @@ -5355,12 +5346,21 @@ "type": "tidelift" } ], - "time": "2022-08-12T06:47:24+00:00" + "time": "2022-09-28T08:42:51+00:00" + } + ], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-mysql-varchar-index-length", + "alias": "0.25.7", + "alias_normalized": "0.25.7.0" } ], - "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "utopia-php/database": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -5384,5 +5384,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/docker-compose.yml b/docker-compose.yml index bd30de3e9f..f143b437f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -83,6 +83,7 @@ services: - ./public:/usr/src/code/public - ./src:/usr/src/code/src - ./dev:/usr/local/dev + - ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database depends_on: - mariadb - redis From e2a63c10a1e50d0318cf8f0c755e9779618ed0d7 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 25 Oct 2022 12:37:19 +1300 Subject: [PATCH 06/12] Fix spec tests --- tests/e2e/General/HTTPTest.php | 61 ++++++++++++---------------------- 1 file changed, 22 insertions(+), 39 deletions(-) diff --git a/tests/e2e/General/HTTPTest.php b/tests/e2e/General/HTTPTest.php index 06ceada976..debef37e97 100644 --- a/tests/e2e/General/HTTPTest.php +++ b/tests/e2e/General/HTTPTest.php @@ -124,56 +124,33 @@ class HTTPTest extends Scope $this->client->setEndpoint($previousEndpoint); } - // public function testSpecSwagger2() - // { - // $response = $this->client->call(Client::METHOD_GET, '/specs/swagger2?platform=client', [ - // 'content-type' => 'application/json', - // ], []); - - // if(!file_put_contents(__DIR__ . '/../../resources/swagger2.json', json_encode($response['body']))) { - // throw new Exception('Failed to save spec file'); - // } - - // $client = new Client(); - // $client->setEndpoint('https://validator.swagger.io'); - - // /** - // * Test for SUCCESS - // */ - // $response = $client->call(Client::METHOD_POST, '/validator/debug', [ - // 'content-type' => 'application/json', - // ], json_decode(file_get_contents(realpath(__DIR__ . '/../../resources/swagger2.json')), true)); - - // $response['body'] = json_decode($response['body'], true); - - // $this->assertEquals(200, $response['headers']['status-code']); - // $this->assertTrue(empty($response['body'])); - - // unlink(realpath(__DIR__ . '/../../resources/swagger2.json')); - // } - - public function testSpecOpenAPI3() + public function testSpecs() { - $response = $this->client->call(Client::METHOD_GET, '/specs/open-api3?platform=console', [ - 'content-type' => 'application/json', - ], []); - $directory = __DIR__ . '/../../../app/config/specs/'; $files = scandir($directory); $client = new Client(); $client->setEndpoint('https://validator.swagger.io'); + $versions = [ + 'latest', + '0.15.x', + '0.14.x', + ]; + foreach ($files as $file) { if (in_array($file, ['.', '..'])) { continue; } - if ( - (strpos($file, 'latest') === false) && - (strpos($file, '0.12.x') === false) && - (strpos($file, '0.13.x') === false) - ) { + $allowed = false; + foreach ($versions as $version) { + if (\str_contains($file, $version)) { + $allowed = true; + break; + } + } + if (!$allowed) { continue; } @@ -186,7 +163,13 @@ class HTTPTest extends Scope $response['body'] = json_decode($response['body'], true); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertTrue(empty($response['body'])); + + if (!empty($response['body']['schemaValidationMessages'])) { + \var_dump($file); + \var_dump($response['body']); + } + + $this->assertEmpty($response['body']['schemaValidationMessages']); } } From 1f49985d26b743768e4a0117c5da24f94f4dfef7 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 25 Oct 2022 19:38:31 +1300 Subject: [PATCH 07/12] Remove var dumps --- tests/e2e/General/HTTPTest.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/e2e/General/HTTPTest.php b/tests/e2e/General/HTTPTest.php index debef37e97..14e6ada761 100644 --- a/tests/e2e/General/HTTPTest.php +++ b/tests/e2e/General/HTTPTest.php @@ -163,12 +163,6 @@ class HTTPTest extends Scope $response['body'] = json_decode($response['body'], true); $this->assertEquals(200, $response['headers']['status-code']); - - if (!empty($response['body']['schemaValidationMessages'])) { - \var_dump($file); - \var_dump($response['body']); - } - $this->assertEmpty($response['body']['schemaValidationMessages']); } } From 1d2d566788b1c67e8f82d43741c3cb6c5e9ce317 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 25 Oct 2022 12:30:58 +0300 Subject: [PATCH 08/12] some changes --- .env | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 55e32cb722..227ea10676 100644 --- a/.env +++ b/.env @@ -17,11 +17,11 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= -_APP_DB_HOST=db-mysql-fra1-shmuel-test-do-user-10204879-0.b.db.ondigitalocean.com -_APP_DB_PORT=25060 +_APP_DB_HOST=mariadb +_APP_DB_PORT=3306 _APP_DB_SCHEMA=appwrite -_APP_DB_USER=doadmin -_APP_DB_PASS=AVNS_LjyH2XQ_tKwGwira3tn +_APP_DB_USER=user +_APP_DB_PASS=password _APP_DB_ROOT_PASS=rootsecretpassword _APP_STORAGE_DEVICE=Local _APP_STORAGE_S3_ACCESS_KEY= From 2a003f8bd058e41b4fc582b00fdfc8db1f666194 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 25 Oct 2022 12:32:58 +0300 Subject: [PATCH 09/12] some changes --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 7cefd70e9e..973aec8539 100644 --- a/composer.json +++ b/composer.json @@ -48,10 +48,10 @@ "utopia-php/abuse": "0.13.*", "utopia-php/analytics": "0.2.*", "utopia-php/audit": "0.14.*", - "utopia-php/cache": "0.7.*", + "utopia-php/cache": "0.6.*", "utopia-php/cli": "0.13.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "dev-mysql-varchar-index-length as 0.25.7", + "utopia-php/database": "0.25.*", "utopia-php/locale": "0.4.*", "utopia-php/registry": "0.5.*", "utopia-php/preloader": "0.2.*", From ca602199daf64439c6d8d28780dbad2d422c9674 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 25 Oct 2022 13:42:30 +0000 Subject: [PATCH 10/12] feat: update mysql changes --- .env | 10 +-- app/config/collections.php | 126 ++++++++++++++++++------------------- composer.lock | 59 +++++++++-------- 3 files changed, 100 insertions(+), 95 deletions(-) diff --git a/.env b/.env index 227ea10676..8f065692a4 100644 --- a/.env +++ b/.env @@ -17,11 +17,11 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= -_APP_DB_HOST=mariadb -_APP_DB_PORT=3306 -_APP_DB_SCHEMA=appwrite -_APP_DB_USER=user -_APP_DB_PASS=password +_APP_DB_HOST=db-mysql-fra1-shmuel-test-do-user-10204879-0.b.db.ondigitalocean.com +_APP_DB_PORT=25060 +_APP_DB_SCHEMA=defaultdb +_APP_DB_USER=doadmin +_APP_DB_PASS=AVNS_sgtjg6ZSHBdg66422x- _APP_DB_ROOT_PASS=rootsecretpassword _APP_STORAGE_DEVICE=Local _APP_STORAGE_S3_ACCESS_KEY= diff --git a/app/config/collections.php b/app/config/collections.php index f9f1d78148..61998e77e8 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -2205,69 +2205,69 @@ $collections = [ ], ], 'indexes' => [ - [ - '$id' => ID::custom('_key_search'), - 'type' => Database::INDEX_FULLTEXT, - 'attributes' => ['search'], - 'lengths' => [], - 'orders' => [], - ], - [ - '$id' => ID::custom('_key_name'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['name'], - 'lengths' => [700], - 'orders' => [], - ], - [ - '$id' => ID::custom('_key_enabled'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['enabled'], - 'lengths' => [], - 'orders' => [], - ], - [ - '$id' => ID::custom('_key_runtime'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['runtime'], - 'lengths' => [700], - 'orders' => [], - ], - [ - '$id' => ID::custom('_key_deployment'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['deployment'], - 'lengths' => [], - 'orders' => [], - ], - [ - '$id' => ID::custom('_key_schedule'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['schedule'], - 'lengths' => [], - 'orders' => [], - ], - [ - '$id' => ID::custom('_key_scheduleNext'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['scheduleNext'], - 'lengths' => [], - 'orders' => [], - ], - [ - '$id' => ID::custom('_key_schedulePrevious'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['schedulePrevious'], - 'lengths' => [], - 'orders' => [], - ], - [ - '$id' => ID::custom('_key_timeout'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['timeout'], - 'lengths' => [], - 'orders' => [], - ], + // [ + // '$id' => ID::custom('_key_search'), + // 'type' => Database::INDEX_FULLTEXT, + // 'attributes' => ['search'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_name'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['name'], + // 'lengths' => [700], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_enabled'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['enabled'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_runtime'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['runtime'], + // 'lengths' => [700], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_deployment'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['deployment'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_schedule'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['schedule'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_scheduleNext'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['scheduleNext'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_schedulePrevious'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['schedulePrevious'], + // 'lengths' => [], + // 'orders' => [], + // ], + // [ + // '$id' => ID::custom('_key_timeout'), + // 'type' => Database::INDEX_KEY, + // 'attributes' => ['timeout'], + // 'lengths' => [], + // 'orders' => [], + // ], ], ], diff --git a/composer.lock b/composer.lock index 5ae81fbd36..4aa4ce0a74 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f0c0b6f8c2a3d8c16a7357f57c2730cc", + "content-hash": "568151395a8877f87d9bdce048adc2dc", "packages": [ { "name": "adhocore/jwt", @@ -1903,26 +1903,24 @@ }, { "name": "utopia-php/cache", - "version": "0.7.0", + "version": "0.6.1", "source": { "type": "git", "url": "https://github.com/utopia-php/cache.git", - "reference": "cd53431242c88299daea2589e21322abe97682cc" + "reference": "9889235a6d3da6cbb1f435201529da4d27c30e79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/cache/zipball/cd53431242c88299daea2589e21322abe97682cc", - "reference": "cd53431242c88299daea2589e21322abe97682cc", + "url": "https://api.github.com/repos/utopia-php/cache/zipball/9889235a6d3da6cbb1f435201529da4d27c30e79", + "reference": "9889235a6d3da6cbb1f435201529da4d27c30e79", "shasum": "" }, "require": { "ext-json": "*", - "ext-memcached": "*", "ext-redis": "*", "php": ">=8.0" }, "require-dev": { - "laravel/pint": "1.2.*", "phpunit/phpunit": "^9.3", "vimeo/psalm": "4.13.1" }, @@ -1936,6 +1934,12 @@ "license": [ "MIT" ], + "authors": [ + { + "name": "Eldad Fux", + "email": "eldad@appwrite.io" + } + ], "description": "A simple cache library to manage application cache storing, loading and purging", "keywords": [ "cache", @@ -1946,9 +1950,9 @@ ], "support": { "issues": "https://github.com/utopia-php/cache/issues", - "source": "https://github.com/utopia-php/cache/tree/0.7.0" + "source": "https://github.com/utopia-php/cache/tree/0.6.1" }, - "time": "2022-10-16T06:04:12+00:00" + "time": "2022-08-10T08:12:46+00:00" }, { "name": "utopia-php/cli", @@ -2056,16 +2060,16 @@ }, { "name": "utopia-php/database", - "version": "dev-mysql-varchar-index-length", + "version": "0.25.5", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "6dfc74188e24ffa600f2e0edc505a2f168e8cc04" + "reference": "6d1c1d46d66553154975a3e8e72d30b5bd2413d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/6dfc74188e24ffa600f2e0edc505a2f168e8cc04", - "reference": "6dfc74188e24ffa600f2e0edc505a2f168e8cc04", + "url": "https://api.github.com/repos/utopia-php/database/zipball/6d1c1d46d66553154975a3e8e72d30b5bd2413d9", + "reference": "6d1c1d46d66553154975a3e8e72d30b5bd2413d9", "shasum": "" }, "require": { @@ -2074,7 +2078,7 @@ "ext-redis": "*", "mongodb/mongodb": "1.8.0", "php": ">=8.0", - "utopia-php/cache": "0.7.*", + "utopia-php/cache": "0.6.*", "utopia-php/framework": "0.*.*" }, "require-dev": { @@ -2094,6 +2098,16 @@ "license": [ "MIT" ], + "authors": [ + { + "name": "Eldad Fux", + "email": "eldad@appwrite.io" + }, + { + "name": "Brandon Leckemby", + "email": "brandon@appwrite.io" + } + ], "description": "A simple library to manage application persistency using multiple database adapters", "keywords": [ "database", @@ -2104,9 +2118,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/mysql-varchar-index-length" + "source": "https://github.com/utopia-php/database/tree/0.25.5" }, - "time": "2022-10-20T19:41:52+00:00" + "time": "2022-09-30T15:01:32+00:00" }, { "name": "utopia-php/domains", @@ -5349,18 +5363,9 @@ "time": "2022-09-28T08:42:51+00:00" } ], - "aliases": [ - { - "package": "utopia-php/database", - "version": "dev-mysql-varchar-index-length", - "alias": "0.25.7", - "alias_normalized": "0.25.7.0" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "utopia-php/database": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From 1594225a07b7e23f09a1578749162bc489e8b479 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 25 Oct 2022 13:49:50 +0000 Subject: [PATCH 11/12] feat: update mysql changes --- .env | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.env b/.env index c4a4efb109..227ea10676 100644 --- a/.env +++ b/.env @@ -17,11 +17,11 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= -_APP_DB_HOST=db-mysql-fra1-shmuel-test-do-user-10204879-0.b.db.ondigitalocean.com -_APP_DB_PORT=25060 -_APP_DB_SCHEMA=defaultdb -_APP_DB_USER=doadmin -_APP_DB_PASS=AVNS_sgtjg6ZSHBdg66422x- +_APP_DB_HOST=mariadb +_APP_DB_PORT=3306 +_APP_DB_SCHEMA=appwrite +_APP_DB_USER=user +_APP_DB_PASS=password _APP_DB_ROOT_PASS=rootsecretpassword _APP_STORAGE_DEVICE=Local _APP_STORAGE_S3_ACCESS_KEY= @@ -56,7 +56,7 @@ _APP_SMTP_PORT=1025 _APP_SMTP_SECURE= _APP_SMTP_USERNAME= _APP_SMTP_PASSWORD= -_APP_SMS_PROVIDER=sms://username:password@mock +_APP_SMS_PROVIDER=sms://mock _APP_SMS_FROM=+123456789 _APP_STORAGE_LIMIT=30000000 _APP_STORAGE_PREVIEW_LIMIT=20000000 From 1d850c3b7f0effc736bef1055c32332e15abecd4 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 25 Oct 2022 13:50:17 +0000 Subject: [PATCH 12/12] feat: update mysql changes --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 227ea10676..65fb54cb04 100644 --- a/.env +++ b/.env @@ -56,7 +56,7 @@ _APP_SMTP_PORT=1025 _APP_SMTP_SECURE= _APP_SMTP_USERNAME= _APP_SMTP_PASSWORD= -_APP_SMS_PROVIDER=sms://mock +_APP_SMS_PROVIDER=sms://username:password@mock _APP_SMS_FROM=+123456789 _APP_STORAGE_LIMIT=30000000 _APP_STORAGE_PREVIEW_LIMIT=20000000