diff options
Diffstat (limited to 'app/DoctrineMigrations/Version20161104073720.php')
-rw-r--r-- | app/DoctrineMigrations/Version20161104073720.php | 10 |
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 | } |