]> git.immae.eu Git - github/wallabag/wallabag.git/blame_incremental - app/DoctrineMigrations/Version20161104073720.php
Update deps
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20161104073720.php
... / ...
CommitLineData
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Added created_at index on entry table.
10 */
11class Version20161104073720 extends WallabagMigration
12{
13 private $indexName = 'IDX_entry_created_at';
14
15 public function up(Schema $schema)
16 {
17 $entryTable = $schema->getTable($this->getTable('entry'));
18 $this->skipIf($entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.');
19
20 $entryTable->addIndex(['created_at'], $this->indexName);
21 }
22
23 public function down(Schema $schema)
24 {
25 $entryTable = $schema->getTable($this->getTable('entry'));
26 $this->skipIf(false === $entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.');
27
28 $entryTable->dropIndex($this->indexName);
29 }
30}