From 5e5e6a6053957093bf8422c4efc00d6d6af1d1bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 3 Mar 2017 19:34:29 +0100 Subject: Added migration to create index on (user_id, url) on Entry table --- app/DoctrineMigrations/Version20170303183149.php | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 app/DoctrineMigrations/Version20170303183149.php (limited to 'app/DoctrineMigrations/Version20170303183149.php') diff --git a/app/DoctrineMigrations/Version20170303183149.php b/app/DoctrineMigrations/Version20170303183149.php new file mode 100644 index 00000000..99737240 --- /dev/null +++ b/app/DoctrineMigrations/Version20170303183149.php @@ -0,0 +1,48 @@ +container = $container; + } + + /** + * @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(['user_id', 'url'], $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); + } +} -- cgit v1.2.3