]>
Commit | Line | Data |
---|---|---|
74b7c098 NL |
1 | <?php |
2 | ||
3 | namespace Application\Migrations; | |
4 | ||
74b7c098 | 5 | use Doctrine\DBAL\Schema\Schema; |
bfe7a692 | 6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; |
74b7c098 NL |
7 | |
8 | /** | |
01736b5a | 9 | * Added index on wallabag_entry.uid. |
74b7c098 | 10 | */ |
bfe7a692 | 11 | class Version20161214094403 extends WallabagMigration |
74b7c098 | 12 | { |
7239082a | 13 | private $indexName = 'IDX_entry_uid'; |
74b7c098 | 14 | |
74b7c098 NL |
15 | /** |
16 | * @param Schema $schema | |
17 | */ | |
18 | public function up(Schema $schema) | |
19 | { | |
20 | $entryTable = $schema->getTable($this->getTable('entry')); | |
21 | $this->skipIf($entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.'); | |
22 | ||
7239082a | 23 | $entryTable->addIndex(['uid'], $this->indexName); |
74b7c098 NL |
24 | } |
25 | ||
26 | /** | |
27 | * @param Schema $schema | |
28 | */ | |
29 | public function down(Schema $schema) | |
30 | { | |
31 | $entryTable = $schema->getTable($this->getTable('entry')); | |
32 | $this->skipIf(false === $entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.'); | |
33 | ||
34 | $entryTable->dropIndex($this->indexName); | |
35 | } | |
36 | } |