Update language in Entry model, and add index

Fixes #4080

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
Olivier Mehani 2019-08-05 23:29:55 +10:00
parent 08a3ed1c68
commit d1dbe10e84
No known key found for this signature in database
GPG key ID: 6F82C3C767D655AA
2 changed files with 27 additions and 2 deletions

View file

@ -0,0 +1,24 @@
<?php declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190806130304 extends AbstractMigration
{
public function up(Schema $schema) : void
{
$this->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');
}
}

View file

@ -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"})
*/