]> git.immae.eu Git - github/wallabag/wallabag.git/blame - app/DoctrineMigrations/Version20161104073720.php
Merge pull request #3982 from wallabag/fix/https-test
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20161104073720.php
CommitLineData
1e7b04d4
JB
1<?php
2
3namespace Application\Migrations;
4
1e7b04d4 5use Doctrine\DBAL\Schema\Schema;
bfe7a692 6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
1e7b04d4 7
b87f1712 8/**
01736b5a 9 * Added created_at index on entry table.
b87f1712 10 */
bfe7a692 11class Version20161104073720 extends WallabagMigration
1e7b04d4 12{
067ae472
NL
13 private $indexName = 'IDX_entry_created_at';
14
1e7b04d4
JB
15 /**
16 * @param Schema $schema
17 */
18 public function up(Schema $schema)
19 {
84c6a48d 20 $entryTable = $schema->getTable($this->getTable('entry'));
067ae472
NL
21 $this->skipIf($entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.');
22
23 $entryTable->addIndex(['created_at'], $this->indexName);
1e7b04d4
JB
24 }
25
26 /**
27 * @param Schema $schema
28 */
29 public function down(Schema $schema)
30 {
067ae472
NL
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);
1e7b04d4
JB
35 }
36}