mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-30 13:01:07 +00:00
feb239ea10
utf8mb4_unicode_ci considers that 'caché' is equal to 'cache' which can lead to attaching incorrect tags to entries. This issue is due to some unicode normalization done by MySQL. utf8mb4_bin makes no unicode normalization, letting wallabag to consider 'cache' and 'caché' as two different tags. We change the collation of the whole table as Doctrine does not support setting a collation on a column for a specific platform (it tries to apply utf8mb4_bin even for pgsql and sqlite). Fixes #3302 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
30 lines
1.2 KiB
PHP
30 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Application\Migrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
|
|
|
|
/**
|
|
* Convert tab label to utf8mb4_bin (MySQL only).
|
|
*/
|
|
final class Version20190511165128 extends WallabagMigration
|
|
{
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
|
|
|
|
$this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;');
|
|
$this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `slug` `slug` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
|
|
|
|
$this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `slug` `slug` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
|
|
$this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
|
|
}
|
|
}
|