mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Move migrations
This commit is contained in:
parent
6dffccc0f5
commit
addf77e07d
62 changed files with 1 additions and 1 deletions
38
migrations/Version20161128131503.php
Normal file
38
migrations/Version20161128131503.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Application\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Wallabag\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]);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue