]> git.immae.eu Git - github/wallabag/wallabag.git/blob - app/DoctrineMigrations/Version20161122203647.php
Fixed migrations with dash into db name
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20161122203647.php
1 <?php
2
3 namespace Application\Migrations;
4
5 use Doctrine\DBAL\Schema\Schema;
6 use 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 */
19 class 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 }