aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOlivier Mehani <shtrom@ssji.net>2019-08-07 21:44:00 +1000
committerOlivier Mehani <shtrom@ssji.net>2019-08-07 21:44:00 +1000
commit588de419e043bc1d8876552809607721cb256094 (patch)
tree7c2bd8cbfa99ad34cdf95dd2ffe87927958a1e02
parentb700b38e1729d50a19ba403004869eb540121ec7 (diff)
downloadwallabag-588de419e043bc1d8876552809607721cb256094.tar.gz
wallabag-588de419e043bc1d8876552809607721cb256094.tar.zst
wallabag-588de419e043bc1d8876552809607721cb256094.zip
Add user_archived index
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
-rw-r--r--app/DoctrineMigrations/Version20190806130304.php6
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php1
2 files changed, 7 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php
index 1449bdd3..4d6b7897 100644
--- a/app/DoctrineMigrations/Version20190806130304.php
+++ b/app/DoctrineMigrations/Version20190806130304.php
@@ -32,16 +32,19 @@ final class Version20190806130304 extends WallabagMigration
32 $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)'); 32 $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)');
33 $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); 33 $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)');
34 $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry', true) . ' (language, user_id)'); 34 $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry', true) . ' (language, user_id)');
35 $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry', true) . ' (user_id, is_archived, archived_at)');
35 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)'); 36 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)');
36 break; 37 break;
37 case 'mysql': 38 case 'mysql':
38 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL'); 39 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL');
39 $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); 40 $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)');
41 $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)');
40 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); 42 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)');
41 break; 43 break;
42 case 'postgresql': 44 case 'postgresql':
43 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)'); 45 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)');
44 $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); 46 $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)');
47 $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)');
45 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); 48 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)');
46 break; 49 break;
47 } 50 }
@@ -57,6 +60,7 @@ final class Version20190806130304 extends WallabagMigration
57 $this->addSql('DROP INDEX hashed_url_user_id'); 60 $this->addSql('DROP INDEX hashed_url_user_id');
58 $this->addSql('DROP INDEX hashed_given_url_user_id'); 61 $this->addSql('DROP INDEX hashed_given_url_user_id');
59 $this->addSql('DROP INDEX user_language'); 62 $this->addSql('DROP INDEX user_language');
63 $this->addSql('DROP INDEX user_archived');
60 $this->addSql('DROP INDEX user_starred'); 64 $this->addSql('DROP INDEX user_starred');
61 $this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM ' . $this->getTable('entry', true)); 65 $this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM ' . $this->getTable('entry', true));
62 $this->addSql('DROP TABLE ' . $this->getTable('entry', true)); 66 $this->addSql('DROP TABLE ' . $this->getTable('entry', true));
@@ -74,11 +78,13 @@ final class Version20190806130304 extends WallabagMigration
74 case 'mysql': 78 case 'mysql':
75 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language LONGTEXT DEFAULT NULL'); 79 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language LONGTEXT DEFAULT NULL');
76 $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); 80 $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry'));
81 $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry'));
77 $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); 82 $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry'));
78 break; 83 break;
79 case 'postgresql': 84 case 'postgresql':
80 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT'); 85 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT');
81 $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); 86 $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry'));
87 $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry'));
82 $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); 88 $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry'));
83 break; 89 break;
84 } 90 }
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index 593ff01d..49f19cfa 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -30,6 +30,7 @@ use Wallabag\UserBundle\Entity\User;
30 * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}}), 30 * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}}),
31 * @ORM\Index(name="hashed_given_url_user_id", columns={"user_id", "hashed_given_url"}, options={"lengths"={null, 40}}), 31 * @ORM\Index(name="hashed_given_url_user_id", columns={"user_id", "hashed_given_url"}, options={"lengths"={null, 40}}),
32 * @ORM\Index(name="user_language", columns={"language", "user_id"}), 32 * @ORM\Index(name="user_language", columns={"language", "user_id"}),
33 * @ORM\Index(name="user_archived", columns={"user_id", "is_archived", "archived_at"}),
33 * @ORM\Index(name="user_starred", columns={"user_id", "is_starred", "starred_at"}) 34 * @ORM\Index(name="user_starred", columns={"user_id", "is_starred", "starred_at"})
34 * } 35 * }
35 * ) 36 * )