]> git.immae.eu Git - github/wallabag/wallabag.git/blame - app/DoctrineMigrations/Version20161122203647.php
Merge pull request #1 from wallabag/master
[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 public function up(Schema $schema)
22 {
84c6a48d 23 $userTable = $schema->getTable($this->getTable('user'));
be2725db 24
65a8c6e1 25 $this->skipIf(false === $userTable->hasColumn('expired') || false === $userTable->hasColumn('credentials_expired'), 'It seems that you already played this migration.');
18d7bc3a 26
84c6a48d 27 $userTable->dropColumn('expired');
84c6a48d 28 $userTable->dropColumn('credentials_expired');
be2725db
JB
29 }
30
be2725db
JB
31 public function down(Schema $schema)
32 {
84c6a48d 33 $userTable = $schema->getTable($this->getTable('user'));
4acbeb93
NL
34
35 $this->skipIf(true === $userTable->hasColumn('expired') || true === $userTable->hasColumn('credentials_expired'), 'It seems that you already played this migration.');
36
37 $userTable->addColumn('expired', 'smallint', ['notnull' => false]);
38 $userTable->addColumn('credentials_expired', 'smallint', ['notnull' => false]);
be2725db
JB
39 }
40}