From 7db34ea8ac65c351cb96826e21f087853b48a078 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 20 Mar 2023 09:38:35 +0200 Subject: [PATCH 1/6] composer.lock --- composer.lock | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/composer.lock b/composer.lock index fa00d8db0..1a02ddfc8 100644 --- a/composer.lock +++ b/composer.lock @@ -646,16 +646,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -693,7 +693,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -701,7 +701,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "nikic/php-parser", @@ -1283,16 +1283,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.4", + "version": "9.6.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d" + "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9125ee085b6d95e78277dc07aa1f46f9e0607b8d", - "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5", + "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5", "shasum": "" }, "require": { @@ -1325,8 +1325,8 @@ "sebastian/version": "^3.0.2" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ "phpunit" @@ -1365,7 +1365,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.4" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5" }, "funding": [ { @@ -1381,7 +1381,7 @@ "type": "tidelift" } ], - "time": "2023-02-27T13:06:37+00:00" + "time": "2023-03-09T06:34:10+00:00" }, { "name": "psr/container", @@ -2672,5 +2672,5 @@ "ext-redis": "*", "ext-mongodb": "*" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } From 87149e2bae7fc9b88a7fbee36f9571c693ca652d Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 20 Mar 2023 10:39:06 +0200 Subject: [PATCH 2/6] indexes --- src/Database/Adapter/MariaDB.php | 4 ++-- src/Database/Adapter/Postgres.php | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Database/Adapter/MariaDB.php b/src/Database/Adapter/MariaDB.php index 7914eea24..431d982fa 100644 --- a/src/Database/Adapter/MariaDB.php +++ b/src/Database/Adapter/MariaDB.php @@ -127,7 +127,7 @@ public function createCollection(string $name, array $attributes = [], array $in `_document` VARCHAR(255) NOT NULL, PRIMARY KEY (`_id`), UNIQUE INDEX `_index1` (`_document`,`_type`,`_permission`), - INDEX `_permission` (`_permission`) + INDEX `_permission` (`_permission`,`_type`,`_document`) )") ->execute(); } catch (\Exception $th) { @@ -806,7 +806,7 @@ public function find(string $collection, array $queries = [], int $limit = 25, i {$order} LIMIT :offset, :limit; "; - +var_dump($sql); if ($timeout) { $sql = $this->setTimeout($sql, $timeout); } diff --git a/src/Database/Adapter/Postgres.php b/src/Database/Adapter/Postgres.php index 6a6eab403..4764d470d 100644 --- a/src/Database/Adapter/Postgres.php +++ b/src/Database/Adapter/Postgres.php @@ -95,12 +95,12 @@ public function createCollection(string $name, array $attributes = [], array $in \"_permissions\" TEXT DEFAULT NULL, " . \implode(' ', $attributes) . " PRIMARY KEY (\"_id\") - )"); - //, - //INDEX (\"_createdAt\"), - //INDEX (\"_updatedAt\") - $stmtIndex = $this->getPDO() - ->prepare("CREATE UNIQUE INDEX \"index_{$namespace}_{$id}_uid\" on {$this->getSQLTable($id)} (LOWER(_uid));"); + ); + CREATE INDEX \"index_{$namespace}_{$id}_createdAt\" ON {$this->getSQLTable($id)} USING btree (\"_createdAt\"); + CREATE INDEX \"index_{$namespace}_{$id}_updatedAt\" ON {$this->getSQLTable($id)} USING btree (\"_updatedAt\"); + "); + + $stmtIndex = $this->getPDO()->prepare("CREATE UNIQUE INDEX \"index_{$namespace}_{$id}_uid\" on {$this->getSQLTable($id)} (LOWER(_uid));"); try { $stmt->execute(); $stmtIndex->execute(); @@ -112,7 +112,10 @@ public function createCollection(string $name, array $attributes = [], array $in \"_permission\" VARCHAR(255) NOT NULL, \"_document\" VARCHAR(255) NOT NULL, PRIMARY KEY (\"_id\") - )") + ); + CREATE UNIQUE INDEX \"index_{$namespace}_{$id}_ukey\" ON {$this->getSQLTable($id. '_perms')} USING btree (\"_document\",\"_type\",\"_permission\"); + CREATE INDEX \"index_{$namespace}_{$id}_permission\" ON {$this->getSQLTable($id. '_perms')} USING btree (\"_permission\",\"_type\",\"_document\"); + ") ->execute(); foreach ($indexes as &$index) { From bdcb152cf61755343de41f8ec402f07bd4abef14 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 20 Mar 2023 10:46:34 +0200 Subject: [PATCH 3/6] remove var_dump --- src/Database/Adapter/MariaDB.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Database/Adapter/MariaDB.php b/src/Database/Adapter/MariaDB.php index 431d982fa..bc0228862 100644 --- a/src/Database/Adapter/MariaDB.php +++ b/src/Database/Adapter/MariaDB.php @@ -806,7 +806,6 @@ public function find(string $collection, array $queries = [], int $limit = 25, i {$order} LIMIT :offset, :limit; "; -var_dump($sql); if ($timeout) { $sql = $this->setTimeout($sql, $timeout); } From 208d90779244cbd615104ec12705208596517258 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 20 Mar 2023 10:50:56 +0200 Subject: [PATCH 4/6] extra line :) --- src/Database/Adapter/MariaDB.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Database/Adapter/MariaDB.php b/src/Database/Adapter/MariaDB.php index bc0228862..374fa4352 100644 --- a/src/Database/Adapter/MariaDB.php +++ b/src/Database/Adapter/MariaDB.php @@ -806,6 +806,7 @@ public function find(string $collection, array $queries = [], int $limit = 25, i {$order} LIMIT :offset, :limit; "; + if ($timeout) { $sql = $this->setTimeout($sql, $timeout); } From 1bea2b5a8a75d11c1c87574f725909e36a34b79d Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 21 Mar 2023 09:31:28 +0200 Subject: [PATCH 5/6] New rule --- bin/tasks/load.php | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/tasks/load.php b/bin/tasks/load.php index 2a04a9290..3f7c6eba8 100644 --- a/bin/tasks/load.php +++ b/bin/tasks/load.php @@ -246,6 +246,7 @@ function addArticle($database, Generator $faker): void // Three random users out of 10,000 get mutate access '$permissions' => [ + Permission::read(Role::any()), Permission::read(Role::user($faker->randomNumber(4))), Permission::read(Role::user($faker->randomNumber(4))), Permission::read(Role::user($faker->randomNumber(4))), From f961f3d915e5654294a3abb3f988fd543d58a2b6 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 29 May 2023 18:57:23 +0300 Subject: [PATCH 6/6] composer.lock --- composer.lock | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/composer.lock b/composer.lock index 1a02ddfc8..c76d23668 100644 --- a/composer.lock +++ b/composer.lock @@ -512,16 +512,16 @@ }, { "name": "fakerphp/faker", - "version": "v1.21.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/FakerPHP/Faker.git", - "reference": "92efad6a967f0b79c499705c69b662f738cc9e4d" + "reference": "f85772abd508bd04e20bb4b1bbe260a68d0066d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/92efad6a967f0b79c499705c69b662f738cc9e4d", - "reference": "92efad6a967f0b79c499705c69b662f738cc9e4d", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/f85772abd508bd04e20bb4b1bbe260a68d0066d2", + "reference": "f85772abd508bd04e20bb4b1bbe260a68d0066d2", "shasum": "" }, "require": { @@ -574,9 +574,9 @@ ], "support": { "issues": "https://github.com/FakerPHP/Faker/issues", - "source": "https://github.com/FakerPHP/Faker/tree/v1.21.0" + "source": "https://github.com/FakerPHP/Faker/tree/v1.22.0" }, - "time": "2022-12-13T13:54:32+00:00" + "time": "2023-05-14T12:31:37+00:00" }, { "name": "laravel/pint", @@ -705,16 +705,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.4", + "version": "v4.15.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e", + "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e", "shasum": "" }, "require": { @@ -755,9 +755,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5" }, - "time": "2023-03-05T19:49:14+00:00" + "time": "2023-05-19T20:20:00+00:00" }, { "name": "pcov/clobber", @@ -1283,16 +1283,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.5", + "version": "9.6.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5" + "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/17d621b3aff84d0c8b62539e269e87d8d5baa76e", + "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e", "shasum": "" }, "require": { @@ -1365,7 +1365,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.8" }, "funding": [ { @@ -1381,7 +1382,7 @@ "type": "tidelift" } ], - "time": "2023-03-09T06:34:10+00:00" + "time": "2023-05-11T05:14:45+00:00" }, { "name": "psr/container", @@ -1782,16 +1783,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { @@ -1836,7 +1837,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, "funding": [ { @@ -1844,7 +1845,7 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment",