]>
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 http_status in `entry_table`. | |
10 | */ | |
11 | class Version20161118134328 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('http_status'), 'It seems that you already played this migration.'); | |
21 | ||
22 | $entryTable->addColumn('http_status', 'string', [ | |
23 | 'length' => 3, | |
24 | 'notnull' => false, | |
25 | ]); | |
26 | } | |
27 | ||
28 | /** | |
29 | * @param Schema $schema | |
30 | */ | |
31 | public function down(Schema $schema) | |
32 | { | |
33 | $entryTable = $schema->getTable($this->getTable('entry')); | |
34 | ||
35 | $this->skipIf(!$entryTable->hasColumn('http_status'), 'It seems that you already played this migration.'); | |
36 | ||
37 | $entryTable->dropColumn('http_status'); | |
38 | } | |
39 | } |