From 5f7ca7c9a6c7914586b621b0e42f5aa3a5887256 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Mon, 10 Feb 2020 11:16:41 +0100 Subject: [PATCH 1/2] add indexes to table "Tokens" --- lib/Alchemy/Phrasea/Core/Version.php | 2 +- lib/Alchemy/Phrasea/Model/Entities/Token.php | 9 ++- lib/classes/patch/410alpha21a.php | 75 ++++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 lib/classes/patch/410alpha21a.php diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index 5f488cdd5a..3a3ff63afc 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -16,7 +16,7 @@ class Version /** * @var string */ - private $number = '4.1.0-alpha.20a'; + private $number = '4.1.0-alpha.21a'; /** * @var string diff --git a/lib/Alchemy/Phrasea/Model/Entities/Token.php b/lib/Alchemy/Phrasea/Model/Entities/Token.php index 576cf05d36..81c632f97d 100644 --- a/lib/Alchemy/Phrasea/Model/Entities/Token.php +++ b/lib/Alchemy/Phrasea/Model/Entities/Token.php @@ -15,7 +15,14 @@ use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; /** - * @ORM\Table(name="Tokens") + * @ORM\Table(name="Tokens", + * indexes={ + * @ORM\index(name="type", columns={"type"}), + * @ORM\index(name="created", columns={"created"}), + * @ORM\index(name="updated", columns={"updated"}), + * @ORM\index(name="expiration", columns={"expiration"}) + * } + * ) * @ORM\Entity(repositoryClass="Alchemy\Phrasea\Model\Repositories\TokenRepository") */ class Token diff --git a/lib/classes/patch/410alpha21a.php b/lib/classes/patch/410alpha21a.php new file mode 100644 index 0000000000..f691520b1a --- /dev/null +++ b/lib/classes/patch/410alpha21a.php @@ -0,0 +1,75 @@ +release; + } + + /** + * {@inheritdoc} + */ + public function concern() + { + return $this->concern; + } + + /** + * {@inheritdoc} + */ + public function require_all_upgrades() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function apply(base $appbox, Application $app) + { + foreach(['type', 'created', 'updated', 'expiration'] as $t) { + $sql = "ALTER TABLE `Tokens` ADD INDEX `".$t."` (`".$t."`);"; + try { + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + } + catch (\Exception $e) { + // the inex already exists ? + } + } + + return true; + } +} From 211ba02f595f0ab52ad6d9861aa63db008766c53 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Mon, 10 Feb 2020 11:39:42 +0100 Subject: [PATCH 2/2] bump patch to 22a --- lib/Alchemy/Phrasea/Core/Version.php | 2 +- lib/classes/patch/{410alpha21a.php => 410alpha22a.php} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename lib/classes/patch/{410alpha21a.php => 410alpha22a.php} (93%) diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index 3a3ff63afc..d17062de4c 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -16,7 +16,7 @@ class Version /** * @var string */ - private $number = '4.1.0-alpha.21a'; + private $number = '4.1.0-alpha.22a'; /** * @var string diff --git a/lib/classes/patch/410alpha21a.php b/lib/classes/patch/410alpha22a.php similarity index 93% rename from lib/classes/patch/410alpha21a.php rename to lib/classes/patch/410alpha22a.php index f691520b1a..6a80bd058e 100644 --- a/lib/classes/patch/410alpha21a.php +++ b/lib/classes/patch/410alpha22a.php @@ -11,10 +11,10 @@ use Alchemy\Phrasea\Application; -class patch_410alpha21a implements patchInterface +class patch_410alpha22a implements patchInterface { /** @var string */ - private $release = '4.1.0-alpha.21a'; + private $release = '4.1.0-alpha.22a'; /** @var array */ private $concern = [base::APPLICATION_BOX];