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