]> git.immae.eu Git - github/wallabag/wallabag.git/blame - app/DoctrineMigrations/Version20161128131503.php
Fixed migrations with dash into db name
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20161128131503.php
CommitLineData
07326af5
NL
1<?php
2
3namespace Application\Migrations;
4
07326af5 5use Doctrine\DBAL\Schema\Schema;
bfe7a692 6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
07326af5
NL
7
8/**
9 * Removed locked, credentials_expire_at and expires_at.
10 */
bfe7a692 11class Version20161128131503 extends WallabagMigration
07326af5
NL
12{
13 private $fields = [
14 'locked' => 'smallint',
15 'credentials_expire_at' => 'datetime',
16 'expires_at' => 'datetime',
17 ];
18
07326af5
NL
19 /**
20 * @param Schema $schema
21 */
22 public function up(Schema $schema)
23 {
24 $userTable = $schema->getTable($this->getTable('user'));
25
26 foreach ($this->fields as $field => $type) {
27 $this->skipIf(!$userTable->hasColumn($field), 'It seems that you already played this migration.');
28 $userTable->dropColumn($field);
29 }
30 }
31
32 /**
33 * @param Schema $schema
34 */
35 public function down(Schema $schema)
36 {
37 $userTable = $schema->getTable($this->getTable('user'));
38
39 foreach ($this->fields as $field => $type) {
40 $this->skipIf($userTable->hasColumn($field), 'It seems that you already played this migration.');
4acbeb93 41 $userTable->addColumn($field, $type, ['notnull' => false]);
07326af5
NL
42 }
43 }
44}