]>
Commit | Line | Data |
---|---|---|
e0ef1a1c KD |
1 | <?php |
2 | ||
3 | namespace Application\Migrations; | |
4 | ||
e0ef1a1c | 5 | use Doctrine\DBAL\Schema\Schema; |
bfe7a692 | 6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; |
e0ef1a1c KD |
7 | |
8 | /** | |
eae8138b | 9 | * Add origin_url column. |
e0ef1a1c | 10 | */ |
bfe7a692 | 11 | class Version20171105202000 extends WallabagMigration |
e0ef1a1c | 12 | { |
e0ef1a1c KD |
13 | public function up(Schema $schema) |
14 | { | |
15 | $entryTable = $schema->getTable($this->getTable('entry')); | |
16 | ||
17 | $this->skipIf($entryTable->hasColumn('origin_url'), 'It seems that you already played this migration.'); | |
18 | ||
19 | $entryTable->addColumn('origin_url', 'text', [ | |
20 | 'notnull' => false, | |
21 | ]); | |
22 | } | |
23 | ||
e0ef1a1c KD |
24 | public function down(Schema $schema) |
25 | { | |
26 | $entryTable = $schema->getTable($this->getTable('entry')); | |
27 | ||
28 | $this->skipIf(!$entryTable->hasColumn('origin_url'), 'It seems that you already played this migration.'); | |
29 | ||
30 | $entryTable->dropColumn('origin_url'); | |
31 | } | |
e0ef1a1c | 32 | } |