From d1dbe10e8460b7117c98ee1e02735602887fd3a4 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Mon, 5 Aug 2019 23:29:55 +1000 Subject: Update language in Entry model, and add index Fixes #4080 Signed-off-by: Olivier Mehani --- app/DoctrineMigrations/Version20190806130304.php | 24 ++++++++++++++++++++++++ src/Wallabag/CoreBundle/Entity/Entry.php | 5 +++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 app/DoctrineMigrations/Version20190806130304.php diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php new file mode 100644 index 00000000..27d3ddad --- /dev/null +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -0,0 +1,24 @@ +addSql('ALTER TABLE wallabag_entry CHANGE language language VARCHAR(20) DEFAULT NULL'); + $this->addSql('CREATE INDEX user_language ON wallabag_entry (language, user_id)'); + } + + public function down(Schema $schema) : void + { + $this->addSql('DROP INDEX user_language ON `wallabag_entry`'); + $this->addSql('ALTER TABLE `wallabag_entry` CHANGE language language LONGTEXT DEFAULT NULL COLLATE utf8mb4_unicode_ci'); + } +} diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 4d5e6fc9..eb185b8c 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -28,7 +28,8 @@ use Wallabag\UserBundle\Entity\User; * @ORM\Index(name="created_at", columns={"created_at"}), * @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="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\HasLifecycleCallbacks() @@ -221,7 +222,7 @@ class Entry /** * @var string * - * @ORM\Column(name="language", type="text", nullable=true) + * @ORM\Column(name="language", type="string", length=20, nullable=true) * * @Groups({"entries_for_user", "export_all"}) */ -- cgit v1.2.3