diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-10-29 14:33:41 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-10-29 14:33:41 +0100 |
commit | 48c802da124ccb44f9602ae05af3bf1d2082a8d0 (patch) | |
tree | e3c1d7acf3cc9ac9582880210671c6253928af77 /app/DoctrineMigrations/Version20181029131313.php | |
parent | 2e1c165316102a622f6f57bcb3422aaa76962043 (diff) | |
download | wallabag-48c802da124ccb44f9602ae05af3bf1d2082a8d0.tar.gz wallabag-48c802da124ccb44f9602ae05af3bf1d2082a8d0.tar.zst wallabag-48c802da124ccb44f9602ae05af3bf1d2082a8d0.zip |
fixup! Debug MySQL failing
Diffstat (limited to 'app/DoctrineMigrations/Version20181029131313.php')
-rw-r--r-- | app/DoctrineMigrations/Version20181029131313.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20181029131313.php b/app/DoctrineMigrations/Version20181029131313.php new file mode 100644 index 00000000..328dc80e --- /dev/null +++ b/app/DoctrineMigrations/Version20181029131313.php | |||
@@ -0,0 +1,38 @@ | |||
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 | { | ||
17 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME TO ' . $this->getTable('internal_setting') . ';'); | ||
18 | |||
19 | if ('mysql' === $this->connection->getDatabasePlatform()->getName()) { | ||
20 | $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | ||
21 | |||
22 | $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' CHANGE `name` `name` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | ||
23 | $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' CHANGE `section` `section` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | ||
24 | } | ||
25 | } | ||
26 | |||
27 | public function down(Schema $schema): void | ||
28 | { | ||
29 | $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME TO ' . $this->getTable('craue_config_setting') . ';'); | ||
30 | |||
31 | if ('mysql' === $this->connection->getDatabasePlatform()->getName()) { | ||
32 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | ||
33 | |||
34 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | ||
35 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | ||
36 | } | ||
37 | } | ||
38 | } | ||