2017-05-10 10:46:32 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Application\Migrations;
|
|
|
|
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
2018-06-14 13:43:09 +02:00
|
|
|
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
|
2017-05-10 10:46:32 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Changed length for username, username_canonical, email and email_canonical fields in wallabag_user table.
|
|
|
|
*/
|
2018-06-14 13:43:09 +02:00
|
|
|
class Version20170510082609 extends WallabagMigration
|
2017-05-10 10:46:32 +02:00
|
|
|
{
|
|
|
|
private $fields = [
|
|
|
|
'username',
|
|
|
|
'username_canonical',
|
|
|
|
'email',
|
|
|
|
'email_canonical',
|
|
|
|
];
|
|
|
|
|
|
|
|
public function up(Schema $schema)
|
|
|
|
{
|
2017-10-09 16:47:15 +02:00
|
|
|
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
|
2017-05-10 10:46:32 +02:00
|
|
|
|
|
|
|
foreach ($this->fields as $field) {
|
2017-07-01 09:52:38 +02:00
|
|
|
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(180) NOT NULL;');
|
2017-05-10 10:46:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down(Schema $schema)
|
|
|
|
{
|
2017-10-09 16:47:15 +02:00
|
|
|
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
|
2017-05-10 10:46:32 +02:00
|
|
|
|
|
|
|
foreach ($this->fields as $field) {
|
2017-07-01 09:52:38 +02:00
|
|
|
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(255) NOT NULL;');
|
2017-05-10 10:46:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|