2016-11-28 13:25:18 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Application\Migrations;
|
|
|
|
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
2024-02-19 01:30:12 +01:00
|
|
|
use Wallabag\Doctrine\WallabagMigration;
|
2016-11-28 13:25:18 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removed locked, credentials_expire_at and expires_at.
|
|
|
|
*/
|
2018-06-14 13:43:09 +02:00
|
|
|
class Version20161128131503 extends WallabagMigration
|
2016-11-28 13:25:18 +01:00
|
|
|
{
|
|
|
|
private $fields = [
|
|
|
|
'locked' => 'smallint',
|
|
|
|
'credentials_expire_at' => 'datetime',
|
|
|
|
'expires_at' => 'datetime',
|
|
|
|
];
|
|
|
|
|
2022-12-14 14:36:29 +01:00
|
|
|
public function up(Schema $schema): void
|
2016-11-28 13:25:18 +01:00
|
|
|
{
|
|
|
|
$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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-14 14:36:29 +01:00
|
|
|
public function down(Schema $schema): void
|
2016-11-28 13:25:18 +01:00
|
|
|
{
|
|
|
|
$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.');
|
2017-01-23 14:16:00 +01:00
|
|
|
$userTable->addColumn($field, $type, ['notnull' => false]);
|
2016-11-28 13:25:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|