]>
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 | * Added action_mark_as_read field on config table. | |
10 | */ | |
11 | class Version20161106113822 extends WallabagMigration | |
12 | { | |
13 | /** | |
14 | * @param Schema $schema | |
15 | */ | |
16 | public function up(Schema $schema) | |
17 | { | |
18 | $configTable = $schema->getTable($this->getTable('config')); | |
19 | ||
20 | $this->skipIf($configTable->hasColumn('action_mark_as_read'), 'It seems that you already played this migration.'); | |
21 | ||
22 | $configTable->addColumn('action_mark_as_read', 'integer', [ | |
23 | 'default' => 0, | |
24 | 'notnull' => false, | |
25 | ]); | |
26 | } | |
27 | ||
28 | /** | |
29 | * @param Schema $schema | |
30 | */ | |
31 | public function down(Schema $schema) | |
32 | { | |
33 | $configTable = $schema->getTable($this->getTable('config')); | |
34 | ||
35 | $this->skipIf(!$configTable->hasColumn('action_mark_as_read'), 'It seems that you already played this migration.'); | |
36 | ||
37 | $configTable->dropColumn('action_mark_as_read'); | |
38 | } | |
39 | } |