]> git.immae.eu Git - github/wallabag/wallabag.git/blame - app/DoctrineMigrations/Version20161122203647.php
Fixed migrations with dash into db name
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20161122203647.php
CommitLineData
be2725db
JB
1<?php
2
3namespace Application\Migrations;
4
be2725db 5use Doctrine\DBAL\Schema\Schema;
bfe7a692 6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
be2725db
JB
7
8/**
18d7bc3a 9 * Methods and properties removed from `FOS\UserBundle\Model\User`.
be2725db
JB
10 *
11 * - `$expired`
12 * - `$credentialsExpired`
13 * - `setExpired()` (use `setExpiresAt(\DateTime::now()` instead)
14 * - `setCredentialsExpired()` (use `setCredentialsExpireAt(\DateTime::now()` instead)
15 *
16 * You need to drop the fields `expired` and `credentials_expired` from your database
17 * schema, because they aren't mapped anymore.
18 */
bfe7a692 19class Version20161122203647 extends WallabagMigration
be2725db 20{
be2725db
JB
21 /**
22 * @param Schema $schema
23 */
24 public function up(Schema $schema)
25 {
84c6a48d 26 $userTable = $schema->getTable($this->getTable('user'));
be2725db 27
65a8c6e1 28 $this->skipIf(false === $userTable->hasColumn('expired') || false === $userTable->hasColumn('credentials_expired'), 'It seems that you already played this migration.');
18d7bc3a 29
84c6a48d 30 $userTable->dropColumn('expired');
84c6a48d 31 $userTable->dropColumn('credentials_expired');
be2725db
JB
32 }
33
34 /**
35 * @param Schema $schema
36 */
37 public function down(Schema $schema)
38 {
84c6a48d 39 $userTable = $schema->getTable($this->getTable('user'));
4acbeb93
NL
40
41 $this->skipIf(true === $userTable->hasColumn('expired') || true === $userTable->hasColumn('credentials_expired'), 'It seems that you already played this migration.');
42
43 $userTable->addColumn('expired', 'smallint', ['notnull' => false]);
44 $userTable->addColumn('credentials_expired', 'smallint', ['notnull' => false]);
be2725db
JB
45 }
46}