mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-04 23:06:27 +00:00
44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Application\Migrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
|
|
|
|
/**
|
|
* Removed locked, credentials_expire_at and expires_at.
|
|
*/
|
|
class Version20161128131503 extends WallabagMigration
|
|
{
|
|
private $fields = [
|
|
'locked' => 'smallint',
|
|
'credentials_expire_at' => 'datetime',
|
|
'expires_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* @param Schema $schema
|
|
*/
|
|
public function up(Schema $schema)
|
|
{
|
|
$userTable = $schema->getTable($this->getTable('user'));
|
|
|
|
foreach ($this->fields as $field => $type) {
|
|
$this->skipIf(!$userTable->hasColumn($field), 'It seems that you already played this migration.');
|
|
$userTable->dropColumn($field);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param Schema $schema
|
|
*/
|
|
public function down(Schema $schema)
|
|
{
|
|
$userTable = $schema->getTable($this->getTable('user'));
|
|
|
|
foreach ($this->fields as $field => $type) {
|
|
$this->skipIf($userTable->hasColumn($field), 'It seems that you already played this migration.');
|
|
$userTable->addColumn($field, $type, ['notnull' => false]);
|
|
}
|
|
}
|
|
}
|