]> git.immae.eu Git - github/wallabag/wallabag.git/blame_incremental - app/DoctrineMigrations/Version20161122203647.php
Merge pull request #3743 from burkemw3/patch-1
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20161122203647.php
... / ...
CommitLineData
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Methods and properties removed from `FOS\UserBundle\Model\User`.
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 */
19class Version20161122203647 extends WallabagMigration
20{
21 /**
22 * @param Schema $schema
23 */
24 public function up(Schema $schema)
25 {
26 $userTable = $schema->getTable($this->getTable('user'));
27
28 $this->skipIf(false === $userTable->hasColumn('expired') || false === $userTable->hasColumn('credentials_expired'), 'It seems that you already played this migration.');
29
30 $userTable->dropColumn('expired');
31 $userTable->dropColumn('credentials_expired');
32 }
33
34 /**
35 * @param Schema $schema
36 */
37 public function down(Schema $schema)
38 {
39 $userTable = $schema->getTable($this->getTable('user'));
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]);
45 }
46}