aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-30 12:29:55 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-30 12:29:55 +0100
commit067ae472cc50a6047d6197f1a042ce239153407d (patch)
tree5d159d9adb28cb1e91513abf39fd572567c6d8e8
parent65a8c6e135e75bbcb37c286ce26b686f5af409c7 (diff)
downloadwallabag-067ae472cc50a6047d6197f1a042ce239153407d.tar.gz
wallabag-067ae472cc50a6047d6197f1a042ce239153407d.tar.zst
wallabag-067ae472cc50a6047d6197f1a042ce239153407d.zip
Named index
-rw-r--r--app/DoctrineMigrations/Version20161104073720.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/DoctrineMigrations/Version20161104073720.php b/app/DoctrineMigrations/Version20161104073720.php
index cd2029cb..4721426a 100644
--- a/app/DoctrineMigrations/Version20161104073720.php
+++ b/app/DoctrineMigrations/Version20161104073720.php
@@ -14,6 +14,8 @@ class Version20161104073720 extends AbstractMigration implements ContainerAwareI
14 */ 14 */
15 private $container; 15 private $container;
16 16
17 private $indexName = 'IDX_entry_created_at';
18
17 public function setContainer(ContainerInterface $container = null) 19 public function setContainer(ContainerInterface $container = null)
18 { 20 {
19 $this->container = $container; 21 $this->container = $container;
@@ -30,7 +32,9 @@ class Version20161104073720 extends AbstractMigration implements ContainerAwareI
30 public function up(Schema $schema) 32 public function up(Schema $schema)
31 { 33 {
32 $entryTable = $schema->getTable($this->getTable('entry')); 34 $entryTable = $schema->getTable($this->getTable('entry'));
33 $entryTable->addIndex(['created_at']); 35 $this->skipIf($entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.');
36
37 $entryTable->addIndex(['created_at'], $this->indexName);
34 } 38 }
35 39
36 /** 40 /**
@@ -38,5 +42,9 @@ class Version20161104073720 extends AbstractMigration implements ContainerAwareI
38 */ 42 */
39 public function down(Schema $schema) 43 public function down(Schema $schema)
40 { 44 {
45 $entryTable = $schema->getTable($this->getTable('entry'));
46 $this->skipIf(false === $entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.');
47
48 $entryTable->dropIndex($this->indexName);
41 } 49 }
42} 50}