1
0
mirror of https://github.com/wallabag/wallabag.git synced 2024-12-21 12:44:12 +01:00
wallabag/app/DoctrineMigrations/Version20161128131503.php
Jeremy Benoist b3099f68c5
Update all Doctrine deps
Also update these deps to be compatible with latest Doctrine version:
- `friendsofsymfony/oauth-server-bundle`
- `lexik/form-filter-bundle`
- `dama/doctrine-test-bundle`
2022-12-16 10:29:42 +01:00

39 lines
1.1 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',
];
public function up(Schema $schema): void
{
$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);
}
}
public function down(Schema $schema): void
{
$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]);
}
}
}