]>
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 origin_url column. | |
10 | */ | |
11 | class Version20171105202000 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('origin_url'), 'It seems that you already played this migration.'); | |
21 | ||
22 | $entryTable->addColumn('origin_url', '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('origin_url'), 'It seems that you already played this migration.'); | |
35 | ||
36 | $entryTable->dropColumn('origin_url'); | |
37 | } | |
38 | } |