3 namespace Application\Migrations
;
5 use Doctrine\DBAL\Schema\Schema
;
6 use Wallabag\CoreBundle\Doctrine\WallabagMigration
;
9 * Added created_at index on entry table.
11 class Version20161104073720
extends WallabagMigration
13 private $indexName = 'IDX_entry_created_at';
16 * @param Schema $schema
18 public function up(Schema
$schema)
20 $entryTable = $schema->getTable($this->getTable('entry'));
21 $this->skipIf($entryTable->hasIndex($this->indexName
), 'It seems that you already played this migration.');
23 $entryTable->addIndex(['created_at'], $this->indexName
);
27 * @param Schema $schema
29 public function down(Schema
$schema)
31 $entryTable = $schema->getTable($this->getTable('entry'));
32 $this->skipIf(false === $entryTable->hasIndex($this->indexName
), 'It seems that you already played this migration.');
34 $entryTable->dropIndex($this->indexName
);