]>
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 | 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 | ]); | |
22 | ||
23 | $this->skipIf($entryTable->hasColumn('published_by'), 'It seems that you already played this migration.'); | |
24 | ||
25 | $entryTable->addColumn('published_by', 'text', [ | |
26 | 'notnull' => false, | |
27 | ]); | |
28 | } | |
29 | ||
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'); | |
37 | ||
38 | $this->skipIf(!$entryTable->hasColumn('published_by'), 'It seems that you already played this migration.'); | |
39 | ||
40 | $entryTable->dropColumn('published_by'); | |
41 | } | |
42 | } |