From 588de419e043bc1d8876552809607721cb256094 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Wed, 7 Aug 2019 21:44:00 +1000 Subject: Add user_archived index Signed-off-by: Olivier Mehani --- app/DoctrineMigrations/Version20190806130304.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/DoctrineMigrations/Version20190806130304.php') 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 $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)'); $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry', true) . ' (language, user_id)'); + $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry', true) . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)'); break; case 'mysql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL'); $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); + $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)'); $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); + $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); break; } @@ -57,6 +60,7 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('DROP INDEX hashed_url_user_id'); $this->addSql('DROP INDEX hashed_given_url_user_id'); $this->addSql('DROP INDEX user_language'); + $this->addSql('DROP INDEX user_archived'); $this->addSql('DROP INDEX user_starred'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('entry', true)); @@ -74,11 +78,13 @@ final class Version20190806130304 extends WallabagMigration case 'mysql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language LONGTEXT DEFAULT NULL'); $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT'); $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); break; } -- cgit v1.2.3