From 5071c8c9cf4d3fcb79851e3ea089593c81cd3b02 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Tue, 6 Aug 2019 22:39:12 +1000 Subject: Add index on starred entries Fixes #4079 Signed-off-by: Olivier Mehani --- app/DoctrineMigrations/Version20190806131006.php | 22 ++++++++++++++++++++++ src/Wallabag/CoreBundle/Entity/Entry.php | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 app/DoctrineMigrations/Version20190806131006.php diff --git a/app/DoctrineMigrations/Version20190806131006.php b/app/DoctrineMigrations/Version20190806131006.php new file mode 100644 index 00000000..7ad45b57 --- /dev/null +++ b/app/DoctrineMigrations/Version20190806131006.php @@ -0,0 +1,22 @@ +addSql('CREATE INDEX user_starred ON wallabag_entry (user_id, is_starred, starred_at)'); + } + + public function down(Schema $schema) : void + { + $this->addSql('DROP INDEX user_starred ON `wallabag_entry`'); + } +} diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index eb185b8c..593ff01d 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -29,7 +29,8 @@ use Wallabag\UserBundle\Entity\User; * @ORM\Index(name="uid", columns={"uid"}), * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}}), * @ORM\Index(name="hashed_given_url_user_id", columns={"user_id", "hashed_given_url"}, options={"lengths"={null, 40}}), - * @ORM\Index(name="user_language", columns={"language", "user_id"}) + * @ORM\Index(name="user_language", columns={"language", "user_id"}), + * @ORM\Index(name="user_starred", columns={"user_id", "is_starred", "starred_at"}) * } * ) * @ORM\HasLifecycleCallbacks() -- cgit v1.2.3