From d1dbe10e8460b7117c98ee1e02735602887fd3a4 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Mon, 5 Aug 2019 23:29:55 +1000 Subject: Update language in Entry model, and add index Fixes #4080 Signed-off-by: Olivier Mehani --- app/DoctrineMigrations/Version20190806130304.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190806130304.php (limited to 'app/DoctrineMigrations/Version20190806130304.php') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php new file mode 100644 index 00000000..27d3ddad --- /dev/null +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -0,0 +1,24 @@ +addSql('ALTER TABLE wallabag_entry CHANGE language language VARCHAR(20) DEFAULT NULL'); + $this->addSql('CREATE INDEX user_language ON wallabag_entry (language, user_id)'); + } + + public function down(Schema $schema) : void + { + $this->addSql('DROP INDEX user_language ON `wallabag_entry`'); + $this->addSql('ALTER TABLE `wallabag_entry` CHANGE language language LONGTEXT DEFAULT NULL COLLATE utf8mb4_unicode_ci'); + } +} -- cgit v1.2.3 From 24acf2e0f3a6b18c86de6dd7e5efd930aaaad9dd Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 7 Aug 2019 11:25:55 +0200 Subject: Fix migrations --- app/DoctrineMigrations/Version20190806130304.php | 82 +++++++++++++++++++++--- 1 file changed, 72 insertions(+), 10 deletions(-) (limited to 'app/DoctrineMigrations/Version20190806130304.php') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php index 27d3ddad..b1e8f8d0 100644 --- a/app/DoctrineMigrations/Version20190806130304.php +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -1,24 +1,86 @@ -addSql('ALTER TABLE wallabag_entry CHANGE language language VARCHAR(20) DEFAULT NULL'); - $this->addSql('CREATE INDEX user_language ON wallabag_entry (language, user_id)'); + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('DROP INDEX uid'); + $this->addSql('DROP INDEX created_at'); + $this->addSql('DROP INDEX hashed_url_user_id'); + $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); + $this->addSql('DROP INDEX hashed_given_url_user_id'); + $this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, domain_name, preview_picture, uid, http_status, published_at, starred_at, origin_url, archived_at, given_url, reading_time, published_by, headers, hashed_url, hashed_given_url FROM ' . $this->getTable('entry', true)); + $this->addSql('DROP TABLE ' . $this->getTable('entry', true)); + $this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, published_at DATETIME DEFAULT NULL, starred_at DATETIME DEFAULT NULL, origin_url CLOB DEFAULT NULL COLLATE BINARY, archived_at DATETIME DEFAULT NULL, given_url CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER NOT NULL, published_by CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:array) + , headers CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:array) + , hashed_url VARCHAR(40) DEFAULT NULL COLLATE BINARY, hashed_given_url VARCHAR(40) DEFAULT NULL COLLATE BINARY, language VARCHAR(20) DEFAULT NULL, CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO ' . $this->getTable('entry', true) . ' (id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, domain_name, preview_picture, uid, http_status, published_at, starred_at, origin_url, archived_at, given_url, reading_time, published_by, headers, hashed_url, hashed_given_url) SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, domain_name, preview_picture, uid, http_status, published_at, starred_at, origin_url, archived_at, given_url, reading_time, published_by, headers, hashed_url, hashed_given_url FROM __temp__wallabag_entry'); + $this->addSql('DROP TABLE __temp__wallabag_entry'); + $this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)'); + $this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)'); + $this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)'); + $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_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_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER COLUMN language VARCHAR(20) DEFAULT NULL'); + $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); + $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); + break; + } } - public function down(Schema $schema) : void + public function down(Schema $schema): void { - $this->addSql('DROP INDEX user_language ON `wallabag_entry`'); - $this->addSql('ALTER TABLE `wallabag_entry` CHANGE language language LONGTEXT DEFAULT NULL COLLATE utf8mb4_unicode_ci'); + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); + $this->addSql('DROP INDEX created_at'); + $this->addSql('DROP INDEX uid'); + $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_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)); + $this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, hashed_url VARCHAR(40) DEFAULT NULL, origin_url CLOB DEFAULT NULL, given_url CLOB DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, is_archived BOOLEAN NOT NULL, archived_at DATETIME DEFAULT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, published_at DATETIME DEFAULT NULL, published_by CLOB DEFAULT NULL --(DC2Type:array) + , starred_at DATETIME DEFAULT NULL, mimetype CLOB DEFAULT NULL, reading_time INTEGER NOT NULL, domain_name CLOB DEFAULT NULL, preview_picture CLOB DEFAULT NULL, http_status VARCHAR(3) DEFAULT NULL, headers CLOB DEFAULT NULL --(DC2Type:array) + , language CLOB DEFAULT NULL COLLATE BINARY)'); + $this->addSql('INSERT INTO ' . $this->getTable('entry', true) . ' (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) 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 __temp__wallabag_entry'); + $this->addSql('DROP TABLE __temp__wallabag_entry'); + $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)'); + $this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)'); + $this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)'); + $this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)'); + $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); + break; + 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_starred ON ' . $this->getTable('entry')); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER COLUMN language LONGTEXT DEFAULT NULL'); + $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); + break; + } } } -- cgit v1.2.3 From b700b38e1729d50a19ba403004869eb540121ec7 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 7 Aug 2019 11:46:58 +0200 Subject: Fix PG migration --- app/DoctrineMigrations/Version20190806130304.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/DoctrineMigrations/Version20190806130304.php') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php index b1e8f8d0..1449bdd3 100644 --- a/app/DoctrineMigrations/Version20190806130304.php +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -40,7 +40,7 @@ final class Version20190806130304 extends WallabagMigration $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 COLUMN language VARCHAR(20) DEFAULT NULL'); + $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_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); break; @@ -77,7 +77,7 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); break; case 'postgresql': - $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER COLUMN language LONGTEXT DEFAULT NULL'); + $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_starred ON ' . $this->getTable('entry')); break; -- cgit v1.2.3 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 From 2b0f4e86b27fec39f5e172fbeba9ce033aef2e79 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Wed, 7 Aug 2019 22:02:37 +1000 Subject: Add user_created 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 4d6b7897..ca94c080 100644 --- a/app/DoctrineMigrations/Version20190806130304.php +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -33,18 +33,21 @@ final class Version20190806130304 extends WallabagMigration $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_created ON ' . $this->getTable('entry', true) . ' (user_id, created_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_created ON ' . $this->getTable('entry') . ' (user_id, created_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_created ON ' . $this->getTable('entry') . ' (user_id, created_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); break; } @@ -61,6 +64,7 @@ final class Version20190806130304 extends WallabagMigration $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_created'); $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)); @@ -79,12 +83,14 @@ final class Version20190806130304 extends WallabagMigration $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_created 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_created ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); break; } -- cgit v1.2.3 From 0810c75e0bd2aa008d69da819a7c51207f159854 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 8 Aug 2019 09:36:03 +0200 Subject: Add `tag_label` & `config_feed_token` index --- app/DoctrineMigrations/Version20190806130304.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'app/DoctrineMigrations/Version20190806130304.php') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php index ca94c080..c577509d 100644 --- a/app/DoctrineMigrations/Version20190806130304.php +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -6,7 +6,13 @@ use Doctrine\DBAL\Schema\Schema; use Wallabag\CoreBundle\Doctrine\WallabagMigration; /** - * Adding more index to kill some slow queries. + * Adding more index to kill some slow queries: + * - user_language + * - user_archived + * - user_created + * - user_starred + * - tag_label + * - config_feed_token */ final class Version20190806130304 extends WallabagMigration { @@ -35,6 +41,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry', true) . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry', true) . ' (user_id, created_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)'); + $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag', true) . ' (label)'); + $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config', true) . ' (feed_token)'); break; case 'mysql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL'); @@ -42,6 +50,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); + $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag') . ' (label (255))'); + $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config') . ' (feed_token (255))'); break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)'); @@ -49,6 +59,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); + $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag') . ' (label)'); + $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config') . ' (feed_token)'); break; } } @@ -66,6 +78,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('DROP INDEX user_archived'); $this->addSql('DROP INDEX user_created'); $this->addSql('DROP INDEX user_starred'); + $this->addSql('DROP INDEX tag_label'); + $this->addSql('DROP INDEX config_feed_token'); $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)); $this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, hashed_url VARCHAR(40) DEFAULT NULL, origin_url CLOB DEFAULT NULL, given_url CLOB DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, is_archived BOOLEAN NOT NULL, archived_at DATETIME DEFAULT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, published_at DATETIME DEFAULT NULL, published_by CLOB DEFAULT NULL --(DC2Type:array) @@ -85,6 +99,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX tag_label ON ' . $this->getTable('tag')); + $this->addSql('DROP INDEX config_feed_token ON ' . $this->getTable('config')); break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT'); @@ -92,6 +108,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX tag_label ON ' . $this->getTable('tag')); + $this->addSql('DROP INDEX config_feed_token ON ' . $this->getTable('config')); break; } } -- cgit v1.2.3 From 00567d9ccde71eba1aabf8fa0d547897f6870b28 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 8 Aug 2019 11:45:39 +0200 Subject: CS --- app/DoctrineMigrations/Version20190806130304.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/DoctrineMigrations/Version20190806130304.php') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php index c577509d..8b0271b1 100644 --- a/app/DoctrineMigrations/Version20190806130304.php +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -12,7 +12,7 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; * - user_created * - user_starred * - tag_label - * - config_feed_token + * - config_feed_token. */ final class Version20190806130304 extends WallabagMigration { -- cgit v1.2.3