]> git.immae.eu Git - github/wallabag/wallabag.git/blame - app/DoctrineMigrations/Version20170405182620.php
Merge pull request #4438 from wallabag/dependabot/composer/scheb/two-factor-bundle...
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20170405182620.php
CommitLineData
5e9009ce
NL
1<?php
2
3namespace Application\Migrations;
4
5e9009ce 5use Doctrine\DBAL\Schema\Schema;
bfe7a692 6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
5e9009ce
NL
7
8/**
7b0b3622 9 * Add published_at and published_by in `entry` table.
5e9009ce 10 */
bfe7a692 11class Version20170405182620 extends WallabagMigration
5e9009ce 12{
5e9009ce
NL
13 public function up(Schema $schema)
14 {
15 $entryTable = $schema->getTable($this->getTable('entry'));
16
17 $this->skipIf($entryTable->hasColumn('published_at'), 'It seems that you already played this migration.');
18
19 $entryTable->addColumn('published_at', 'datetime', [
20 'notnull' => false,
21 ]);
7b0b3622 22
3aa655e4
NL
23 $this->skipIf($entryTable->hasColumn('published_by'), 'It seems that you already played this migration.');
24
7b0b3622
NL
25 $entryTable->addColumn('published_by', 'text', [
26 'notnull' => false,
27 ]);
5e9009ce
NL
28 }
29
5e9009ce
NL
30 public function down(Schema $schema)
31 {
32 $entryTable = $schema->getTable($this->getTable('entry'));
33
34 $this->skipIf(!$entryTable->hasColumn('published_at'), 'It seems that you already played this migration.');
35
36 $entryTable->dropColumn('published_at');
3aa655e4
NL
37
38 $this->skipIf(!$entryTable->hasColumn('published_by'), 'It seems that you already played this migration.');
39
7b0b3622 40 $entryTable->dropColumn('published_by');
5e9009ce
NL
41 }
42}