]> git.immae.eu Git - github/wallabag/wallabag.git/blame - app/DoctrineMigrations/Version20170510082609.php
Merge pull request #4276 from wallabag/dependabot/composer/scheb/two-factor-bundle...
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20170510082609.php
CommitLineData
8c3158eb
NL
1<?php
2
3namespace Application\Migrations;
4
8c3158eb 5use Doctrine\DBAL\Schema\Schema;
bfe7a692 6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
8c3158eb
NL
7
8/**
9 * Changed length for username, username_canonical, email and email_canonical fields in wallabag_user table.
10 */
bfe7a692 11class Version20170510082609 extends WallabagMigration
8c3158eb
NL
12{
13 private $fields = [
14 'username',
15 'username_canonical',
16 'email',
17 'email_canonical',
18 ];
19
8c3158eb
NL
20 public function up(Schema $schema)
21 {
3ef055ce 22 $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
8c3158eb
NL
23
24 foreach ($this->fields as $field) {
f808b016 25 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(180) NOT NULL;');
8c3158eb
NL
26 }
27 }
28
8c3158eb
NL
29 public function down(Schema $schema)
30 {
3ef055ce 31 $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
8c3158eb
NL
32
33 foreach ($this->fields as $field) {
f808b016 34 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(255) NOT NULL;');
8c3158eb
NL
35 }
36 }
37}