diff options
author | Olivier Mehani <shtrom@ssji.net> | 2019-08-05 23:29:55 +1000 |
---|---|---|
committer | Olivier Mehani <shtrom@ssji.net> | 2019-08-06 23:21:18 +1000 |
commit | d1dbe10e8460b7117c98ee1e02735602887fd3a4 (patch) | |
tree | 306cb26dde360326f34e74f5983f39b8b6fd251e | |
parent | 08a3ed1c68972ff2c73584bb668b73c05dcb03ac (diff) | |
download | wallabag-d1dbe10e8460b7117c98ee1e02735602887fd3a4.tar.gz wallabag-d1dbe10e8460b7117c98ee1e02735602887fd3a4.tar.zst wallabag-d1dbe10e8460b7117c98ee1e02735602887fd3a4.zip |
Update language in Entry model, and add index
Fixes #4080
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
-rw-r--r-- | app/DoctrineMigrations/Version20190806130304.php | 24 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 5 |
2 files changed, 27 insertions, 2 deletions
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 @@ | |||
1 | <?php declare(strict_types=1); | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Doctrine\Migrations\AbstractMigration; | ||
7 | |||
8 | /** | ||
9 | * Auto-generated Migration: Please modify to your needs! | ||
10 | */ | ||
11 | final class Version20190806130304 extends AbstractMigration | ||
12 | { | ||
13 | public function up(Schema $schema) : void | ||
14 | { | ||
15 | $this->addSql('ALTER TABLE wallabag_entry CHANGE language language VARCHAR(20) DEFAULT NULL'); | ||
16 | $this->addSql('CREATE INDEX user_language ON wallabag_entry (language, user_id)'); | ||
17 | } | ||
18 | |||
19 | public function down(Schema $schema) : void | ||
20 | { | ||
21 | $this->addSql('DROP INDEX user_language ON `wallabag_entry`'); | ||
22 | $this->addSql('ALTER TABLE `wallabag_entry` CHANGE language language LONGTEXT DEFAULT NULL COLLATE utf8mb4_unicode_ci'); | ||
23 | } | ||
24 | } | ||
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; | |||
28 | * @ORM\Index(name="created_at", columns={"created_at"}), | 28 | * @ORM\Index(name="created_at", columns={"created_at"}), |
29 | * @ORM\Index(name="uid", columns={"uid"}), | 29 | * @ORM\Index(name="uid", columns={"uid"}), |
30 | * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}}), | 30 | * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}}), |
31 | * @ORM\Index(name="hashed_given_url_user_id", columns={"user_id", "hashed_given_url"}, options={"lengths"={null, 40}}) | 31 | * @ORM\Index(name="hashed_given_url_user_id", columns={"user_id", "hashed_given_url"}, options={"lengths"={null, 40}}), |
32 | * @ORM\Index(name="user_language", columns={"language", "user_id"}) | ||
32 | * } | 33 | * } |
33 | * ) | 34 | * ) |
34 | * @ORM\HasLifecycleCallbacks() | 35 | * @ORM\HasLifecycleCallbacks() |
@@ -221,7 +222,7 @@ class Entry | |||
221 | /** | 222 | /** |
222 | * @var string | 223 | * @var string |
223 | * | 224 | * |
224 | * @ORM\Column(name="language", type="text", nullable=true) | 225 | * @ORM\Column(name="language", type="string", length=20, nullable=true) |
225 | * | 226 | * |
226 | * @Groups({"entries_for_user", "export_all"}) | 227 | * @Groups({"entries_for_user", "export_all"}) |
227 | */ | 228 | */ |