]>
Commit | Line | Data |
---|---|---|
48c802da JB |
1 | <?php |
2 | ||
3 | declare(strict_types=1); | |
4 | ||
5 | namespace Application\Migrations; | |
6 | ||
7 | use Doctrine\DBAL\Schema\Schema; | |
8 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |
9 | ||
10 | /** | |
11 | * Force utf8mb4 on craue_config_setting. | |
12 | */ | |
13 | final class Version20181029131313 extends WallabagMigration | |
14 | { | |
15 | public function up(Schema $schema): void | |
16 | { | |
48c802da | 17 | if ('mysql' === $this->connection->getDatabasePlatform()->getName()) { |
a523f1c1 | 18 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
48c802da | 19 | |
a523f1c1 JB |
20 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
21 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | |
48c802da JB |
22 | } |
23 | } | |
24 | ||
25 | public function down(Schema $schema): void | |
26 | { | |
48c802da JB |
27 | if ('mysql' === $this->connection->getDatabasePlatform()->getName()) { |
28 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | |
29 | ||
30 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | |
31 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | |
32 | } | |
33 | } | |
34 | } |