mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
Move migrations
This commit is contained in:
parent
6dffccc0f5
commit
addf77e07d
62 changed files with 1 additions and 1 deletions
46
migrations/Version20170510082609.php
Normal file
46
migrations/Version20170510082609.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace Application\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Platforms\MySQLPlatform;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Wallabag\Doctrine\WallabagMigration;
|
||||
|
||||
/**
|
||||
* Changed length for username, username_canonical, email and email_canonical fields in wallabag_user table.
|
||||
*/
|
||||
class Version20170510082609 extends WallabagMigration
|
||||
{
|
||||
private $fields = [
|
||||
'username',
|
||||
'username_canonical',
|
||||
'email',
|
||||
'email_canonical',
|
||||
];
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
if (!$this->connection->getDatabasePlatform() instanceof MySQLPlatform) {
|
||||
$this->write('This migration only apply to MySQL');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->fields as $field) {
|
||||
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(180) NOT NULL;');
|
||||
}
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
if (!$this->connection->getDatabasePlatform() instanceof MySQLPlatform) {
|
||||
$this->write('This migration only apply to MySQL');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->fields as $field) {
|
||||
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(255) NOT NULL;');
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue