]>
Commit | Line | Data |
---|---|---|
dda6a6ad NL |
1 | <?php |
2 | ||
3 | namespace Application\Migrations; | |
4 | ||
dda6a6ad | 5 | use Doctrine\DBAL\Schema\Schema; |
bfe7a692 | 6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; |
dda6a6ad NL |
7 | |
8 | /** | |
9 | * Added `headers` field in entry table. | |
10 | */ | |
bfe7a692 | 11 | class Version20170511115400 extends WallabagMigration |
dda6a6ad | 12 | { |
dda6a6ad 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('headers'), 'It seems that you already played this migration.'); | |
21 | ||
22 | $entryTable->addColumn('headers', 'text', [ | |
23 | 'notnull' => false, | |
24 | ]); | |
25 | } | |
26 | ||
27 | /** | |
28 | * @param Schema $schema | |
29 | */ | |
30 | public function down(Schema $schema) | |
31 | { | |
32 | $entryTable = $schema->getTable($this->getTable('entry')); | |
33 | ||
34 | $this->skipIf(!$entryTable->hasColumn('headers'), 'It seems that you already played this migration.'); | |
35 | ||
36 | $entryTable->dropColumn('headers'); | |
37 | } | |
38 | } |