2019-05-11 18:07:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Application\Migrations;
|
|
|
|
|
2023-08-05 17:35:09 +00:00
|
|
|
use Doctrine\DBAL\Platforms\MySQLPlatform;
|
2019-05-11 18:07:38 +00:00
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
2024-02-19 00:30:12 +00:00
|
|
|
use Wallabag\Doctrine\WallabagMigration;
|
2019-05-11 18:07:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert tab label to utf8mb4_bin (MySQL only).
|
|
|
|
*/
|
|
|
|
final class Version20190511165128 extends WallabagMigration
|
|
|
|
{
|
|
|
|
public function up(Schema $schema): void
|
|
|
|
{
|
2024-02-18 22:47:34 +00:00
|
|
|
if (!$this->connection->getDatabasePlatform() instanceof MySQLPlatform) {
|
|
|
|
$this->write('This migration only apply to MySQL');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2019-05-11 18:07:38 +00:00
|
|
|
|
|
|
|
$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
|
|
|
|
{
|
2024-02-18 22:47:34 +00:00
|
|
|
if (!$this->connection->getDatabasePlatform() instanceof MySQLPlatform) {
|
|
|
|
$this->write('This migration only apply to MySQL');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2019-05-11 18:07:38 +00:00
|
|
|
|
|
|
|
$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;');
|
|
|
|
}
|
|
|
|
}
|