]>
Commit | Line | Data |
---|---|---|
5e9009ce NL |
1 | <?php |
2 | ||
3 | namespace Application\Migrations; | |
4 | ||
5e9009ce | 5 | use Doctrine\DBAL\Schema\Schema; |
bfe7a692 | 6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; |
5e9009ce NL |
7 | |
8 | /** | |
7b0b3622 | 9 | * Add published_at and published_by in `entry` table. |
5e9009ce | 10 | */ |
bfe7a692 | 11 | class Version20170405182620 extends WallabagMigration |
5e9009ce | 12 | { |
5e9009ce NL |
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 | ]); | |
7b0b3622 | 25 | |
3aa655e4 NL |
26 | $this->skipIf($entryTable->hasColumn('published_by'), 'It seems that you already played this migration.'); |
27 | ||
7b0b3622 NL |
28 | $entryTable->addColumn('published_by', 'text', [ |
29 | 'notnull' => false, | |
30 | ]); | |
5e9009ce NL |
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'); | |
3aa655e4 NL |
43 | |
44 | $this->skipIf(!$entryTable->hasColumn('published_by'), 'It seems that you already played this migration.'); | |
45 | ||
7b0b3622 | 46 | $entryTable->dropColumn('published_by'); |
5e9009ce NL |
47 | } |
48 | } |