]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | ||
3 | namespace Application\Migrations; | |
4 | ||
5 | use Doctrine\DBAL\Schema\Schema; | |
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |
7 | ||
8 | /** | |
9 | * Add published_at and published_by in `entry` table. | |
10 | */ | |
11 | class Version20170405182620 extends WallabagMigration | |
12 | { | |
13 | /** | |
14 | * @param Schema $schema | |
15 | */ | |
16 | public function up(Schema $schema) | |
17 | { | |
18 | $entryTable = $schema->getTable($this->getTable('entry')); | |
19 | ||
20 | $this->skipIf($entryTable->hasColumn('published_at'), 'It seems that you already played this migration.'); | |
21 | ||
22 | $entryTable->addColumn('published_at', 'datetime', [ | |
23 | 'notnull' => false, | |
24 | ]); | |
25 | ||
26 | $this->skipIf($entryTable->hasColumn('published_by'), 'It seems that you already played this migration.'); | |
27 | ||
28 | $entryTable->addColumn('published_by', 'text', [ | |
29 | 'notnull' => false, | |
30 | ]); | |
31 | } | |
32 | ||
33 | /** | |
34 | * @param Schema $schema | |
35 | */ | |
36 | public function down(Schema $schema) | |
37 | { | |
38 | $entryTable = $schema->getTable($this->getTable('entry')); | |
39 | ||
40 | $this->skipIf(!$entryTable->hasColumn('published_at'), 'It seems that you already played this migration.'); | |
41 | ||
42 | $entryTable->dropColumn('published_at'); | |
43 | ||
44 | $this->skipIf(!$entryTable->hasColumn('published_by'), 'It seems that you already played this migration.'); | |
45 | ||
46 | $entryTable->dropColumn('published_by'); | |
47 | } | |
48 | } |