aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/DoctrineMigrations/Version20171218135243.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/DoctrineMigrations/Version20171218135243.php')
-rw-r--r--app/DoctrineMigrations/Version20171218135243.php48
1 files changed, 0 insertions, 48 deletions
diff --git a/app/DoctrineMigrations/Version20171218135243.php b/app/DoctrineMigrations/Version20171218135243.php
deleted file mode 100644
index 3060c920..00000000
--- a/app/DoctrineMigrations/Version20171218135243.php
+++ /dev/null
@@ -1,48 +0,0 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Added indexes on wallabag_entry.url and wallabag_entry.given_url and wallabag_entry.user_id.
10 */
11class Version20171218135243 extends WallabagMigration
12{
13 private $indexGivenUrl = 'IDX_entry_given_url';
14
15 /**
16 * @param Schema $schema
17 */
18 public function up(Schema $schema)
19 {
20 $entryTable = $schema->getTable($this->getTable('entry'));
21 $this->skipIf($entryTable->hasIndex($this->indexGivenUrl), 'It seems that you already played this migration.');
22
23 switch ($this->connection->getDatabasePlatform()->getName()) {
24 case 'sqlite':
25 $sql = 'CREATE UNIQUE INDEX ' . $this->indexGivenUrl . ' ON ' . $this->getTable('entry') . ' (url, given_url, user_id);';
26 break;
27 case 'mysql':
28 $sql = 'CREATE UNIQUE INDEX ' . $this->indexGivenUrl . ' ON ' . $this->getTable('entry') . ' (url (255), given_url (255), user_id);';
29 break;
30 case 'postgresql':
31 $sql = 'CREATE UNIQUE INDEX ' . $this->indexGivenUrl . ' ON ' . $this->getTable('entry') . ' (url, given_url, user_id);';
32 break;
33 }
34
35 $this->addSql($sql);
36 }
37
38 /**
39 * @param Schema $schema
40 */
41 public function down(Schema $schema)
42 {
43 $entryTable = $schema->getTable($this->getTable('entry'));
44 $this->skipIf(false === $entryTable->hasIndex($this->indexGivenUrl), 'It seems that you already played this migration.');
45
46 $entryTable->dropIndex($this->indexGivenUrl);
47 }
48}