From 74b7c0985d3ff2b2011d0809c9b71e505e9aa947 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 14 Dec 2016 09:47:07 +0100 Subject: [PATCH] Added index on entry.uuid Useful for entry sharing --- .../Version20161214094403.php | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 app/DoctrineMigrations/Version20161214094403.php diff --git a/app/DoctrineMigrations/Version20161214094403.php b/app/DoctrineMigrations/Version20161214094403.php new file mode 100644 index 00000000..fc9acb5a --- /dev/null +++ b/app/DoctrineMigrations/Version20161214094403.php @@ -0,0 +1,53 @@ +container = $container; + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix').$tableName; + } + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + $this->skipIf($entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.'); + + $entryTable->addIndex(['uuid'], $this->indexName); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + $this->skipIf(false === $entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.'); + + $entryTable->dropIndex($this->indexName); + } +} -- 2.41.0