]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Added indexes on is_archived and is_starred
authorNicolas Lœuillet <nicolas@loeuillet.org>
Fri, 27 Jan 2017 10:44:04 +0000 (11:44 +0100)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Fri, 27 Jan 2017 10:44:04 +0000 (11:44 +0100)
app/DoctrineMigrations/Version20170127093841.php [new file with mode: 0644]
docs/de/user/query-upgrade-21-22.rst
docs/de/user/upgrade.rst
docs/en/user/query-upgrade-21-22.rst
docs/en/user/upgrade.rst
docs/fr/user/query-upgrade-21-22.rst
docs/fr/user/upgrade.rst

diff --git a/app/DoctrineMigrations/Version20170127093841.php b/app/DoctrineMigrations/Version20170127093841.php
new file mode 100644 (file)
index 0000000..384529a
--- /dev/null
@@ -0,0 +1,58 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration;
+use Doctrine\DBAL\Schema\Schema;
+use Symfony\Component\DependencyInjection\ContainerAwareInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Added indexes on wallabag_entry.is_starred and wallabag_entry.is_archived
+ */
+class Version20170127093841 extends AbstractMigration implements ContainerAwareInterface
+{
+    /**
+     * @var ContainerInterface
+     */
+    private $container;
+
+    private $indexStarredName = 'IDX_entry_starred';
+    private $indexArchivedName = 'IDX_entry_archived';
+
+    public function setContainer(ContainerInterface $container = null)
+    {
+        $this->container = $container;
+    }
+
+    private function getTable($tableName)
+    {
+        return $this->container->getParameter('database_table_prefix').$tableName;
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        $entryTable = $schema->getTable($this->getTable('entry'));
+        $this->skipIf($entryTable->hasIndex($this->indexStarredName), 'It seems that you already played this migration.');
+        $this->skipIf($entryTable->hasIndex($this->indexStarredName), 'It seems that you already played this migration.');
+
+        $entryTable->addIndex(['is_starred'], $this->indexStarredName);
+        $entryTable->addIndex(['is_archived'], $this->indexArchivedName);
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+        $entryTable = $schema->getTable($this->getTable('entry'));
+        $this->skipIf(false === $entryTable->hasIndex($this->indexStarredName), 'It seems that you already played this migration.');
+        $this->skipIf(false === $entryTable->hasIndex($this->indexStarredName), 'It seems that you already played this migration.');
+
+        $entryTable->dropIndex($this->indexStarredName);
+        $entryTable->dropIndex($this->indexArchivedName);
+    }
+}
index cd201dc2c43fed0eb49cf7b71875f826ed08a480..f32d5a196b15f4f8834b898a4ceb5ccc1725b327 100644 (file)
@@ -795,3 +795,85 @@ Migration down
     DROP TABLE __temp__wallabag_entry
     CREATE INDEX created_at_idx ON wallabag_entry (created_at)
     CREATE INDEX IDX_F4D18282A76ED395 ON wallabag_entry (user_id)
+
+Migration 20170127093841
+------------------------
+
+MySQL
+^^^^^
+
+Migration up
+""""""""""""
+
+.. code-block:: sql
+
+    CREATE INDEX IDX_entry_starred ON wallabag_entry (is_starred)
+    CREATE INDEX IDX_entry_archived ON wallabag_entry (is_archived)
+
+Migration down
+""""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX IDX_entry_starred ON wallabag_entry
+    DROP INDEX IDX_entry_archived ON wallabag_entry
+
+PostgreSQL
+^^^^^^^^^^
+
+Migration up
+""""""""""""
+
+.. code-block:: sql
+
+    CREATE INDEX IDX_entry_starred ON wallabag_entry (is_starred)
+    CREATE INDEX IDX_entry_archived ON wallabag_entry (is_archived)
+
+Migration down
+""""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX IDX_entry_starred
+    DROP INDEX IDX_entry_archived
+
+SQLite
+^^^^^^
+
+Migration up
+""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX uid
+    DROP INDEX created_at
+    DROP INDEX IDX_F4D18282A76ED395
+    CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM wallabag_entry
+    DROP TABLE wallabag_entry
+    CREATE TABLE wallabag_entry (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, 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, language CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT '0', http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, PRIMARY KEY(id))
+    INSERT INTO wallabag_entry (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status) SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM __temp__wallabag_entry
+    DROP TABLE __temp__wallabag_entry
+    CREATE INDEX uid ON wallabag_entry (uid)
+    CREATE INDEX created_at ON wallabag_entry (created_at)
+    CREATE INDEX IDX_F4D18282A76ED395 ON wallabag_entry (user_id)
+    CREATE INDEX IDX_entry_starred ON wallabag_entry (is_starred)
+    CREATE INDEX IDX_entry_archived ON wallabag_entry (is_archived)
+
+Migration down
+""""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX IDX_entry_archived
+    DROP INDEX IDX_entry_starred
+    DROP INDEX IDX_F4D18282A76ED395
+    DROP INDEX created_at
+    DROP INDEX uid
+    CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM wallabag_entry
+    DROP TABLE wallabag_entry
+    CREATE TABLE wallabag_entry (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, 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, language CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT '0', http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, PRIMARY KEY(id))
+    INSERT INTO wallabag_entry (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status) SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM __temp__wallabag_entry
+    DROP TABLE __temp__wallabag_entry
+    CREATE INDEX IDX_F4D18282A76ED395 ON wallabag_entry (user_id)
+    CREATE INDEX created_at ON wallabag_entry (created_at)
+    CREATE INDEX uid ON wallabag_entry (uid)
index 1107616e2fc3ace708c7eef7faf477c3af46b67e..544c7167da8c9ed3d8e15ffbaa1b5d076b13c8e4 100644 (file)
@@ -37,6 +37,11 @@ Dies ist die Migrationsliste von 2.1.x auf 2.2.0:
 * ``20161118134328``: ``http_status``-Feld zur ``entry``-Tabelle hinzugefügt
 * ``20161122144743``: Interne Einstellung für das (de-)aktivieren zum Holen von Artikeln mit einer Paywall hinzugefügt
 * ``20161122203647``: ``expired``- und ``credentials_expired``-Feld aus der ``user``-Tabelle entfernt
+* ``20161128084725``: added ``list_mode`` field on ``config`` table
+* ``20161128131503``: dropped ``locked``, ``credentials_expire_at`` and ``expires_at`` fields on ``user`` table
+* ``20161214094402``: renamed ``uuid`` to ``uid`` on ``entry`` table
+* ``20161214094403``: added ``uid`` index on ``entry`` table
+* ``20170127093841``: added ``is_starred`` and ``is_archived`` indexes on ``entry`` table
 
 Upgrade auf einem Shared Hosting
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
index cd201dc2c43fed0eb49cf7b71875f826ed08a480..f32d5a196b15f4f8834b898a4ceb5ccc1725b327 100644 (file)
@@ -795,3 +795,85 @@ Migration down
     DROP TABLE __temp__wallabag_entry
     CREATE INDEX created_at_idx ON wallabag_entry (created_at)
     CREATE INDEX IDX_F4D18282A76ED395 ON wallabag_entry (user_id)
+
+Migration 20170127093841
+------------------------
+
+MySQL
+^^^^^
+
+Migration up
+""""""""""""
+
+.. code-block:: sql
+
+    CREATE INDEX IDX_entry_starred ON wallabag_entry (is_starred)
+    CREATE INDEX IDX_entry_archived ON wallabag_entry (is_archived)
+
+Migration down
+""""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX IDX_entry_starred ON wallabag_entry
+    DROP INDEX IDX_entry_archived ON wallabag_entry
+
+PostgreSQL
+^^^^^^^^^^
+
+Migration up
+""""""""""""
+
+.. code-block:: sql
+
+    CREATE INDEX IDX_entry_starred ON wallabag_entry (is_starred)
+    CREATE INDEX IDX_entry_archived ON wallabag_entry (is_archived)
+
+Migration down
+""""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX IDX_entry_starred
+    DROP INDEX IDX_entry_archived
+
+SQLite
+^^^^^^
+
+Migration up
+""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX uid
+    DROP INDEX created_at
+    DROP INDEX IDX_F4D18282A76ED395
+    CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM wallabag_entry
+    DROP TABLE wallabag_entry
+    CREATE TABLE wallabag_entry (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, 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, language CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT '0', http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, PRIMARY KEY(id))
+    INSERT INTO wallabag_entry (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status) SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM __temp__wallabag_entry
+    DROP TABLE __temp__wallabag_entry
+    CREATE INDEX uid ON wallabag_entry (uid)
+    CREATE INDEX created_at ON wallabag_entry (created_at)
+    CREATE INDEX IDX_F4D18282A76ED395 ON wallabag_entry (user_id)
+    CREATE INDEX IDX_entry_starred ON wallabag_entry (is_starred)
+    CREATE INDEX IDX_entry_archived ON wallabag_entry (is_archived)
+
+Migration down
+""""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX IDX_entry_archived
+    DROP INDEX IDX_entry_starred
+    DROP INDEX IDX_F4D18282A76ED395
+    DROP INDEX created_at
+    DROP INDEX uid
+    CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM wallabag_entry
+    DROP TABLE wallabag_entry
+    CREATE TABLE wallabag_entry (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, 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, language CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT '0', http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, PRIMARY KEY(id))
+    INSERT INTO wallabag_entry (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status) SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM __temp__wallabag_entry
+    DROP TABLE __temp__wallabag_entry
+    CREATE INDEX IDX_F4D18282A76ED395 ON wallabag_entry (user_id)
+    CREATE INDEX created_at ON wallabag_entry (created_at)
+    CREATE INDEX uid ON wallabag_entry (uid)
index 99260e13509fc4b1f177d4974593d7dc5b380187..889b530054e9f06834793bebd034663e682977e2 100644 (file)
@@ -43,7 +43,9 @@ Here is the migrations list for 2.1.x to 2.2.0 release:
 * ``20161122203647``: dropped ``expired`` and ``credentials_expired`` fields on ``user`` table
 * ``20161128084725``: added ``list_mode`` field on ``config`` table
 * ``20161128131503``: dropped ``locked``, ``credentials_expire_at`` and ``expires_at`` fields on ``user`` table
+* ``20161214094402``: renamed ``uuid`` to ``uid`` on ``entry`` table
 * ``20161214094403``: added ``uid`` index on ``entry`` table
+* ``20170127093841``: added ``is_starred`` and ``is_archived`` indexes on ``entry`` table
 
 Upgrade on a shared hosting
 ===========================
index cd201dc2c43fed0eb49cf7b71875f826ed08a480..f32d5a196b15f4f8834b898a4ceb5ccc1725b327 100644 (file)
@@ -795,3 +795,85 @@ Migration down
     DROP TABLE __temp__wallabag_entry
     CREATE INDEX created_at_idx ON wallabag_entry (created_at)
     CREATE INDEX IDX_F4D18282A76ED395 ON wallabag_entry (user_id)
+
+Migration 20170127093841
+------------------------
+
+MySQL
+^^^^^
+
+Migration up
+""""""""""""
+
+.. code-block:: sql
+
+    CREATE INDEX IDX_entry_starred ON wallabag_entry (is_starred)
+    CREATE INDEX IDX_entry_archived ON wallabag_entry (is_archived)
+
+Migration down
+""""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX IDX_entry_starred ON wallabag_entry
+    DROP INDEX IDX_entry_archived ON wallabag_entry
+
+PostgreSQL
+^^^^^^^^^^
+
+Migration up
+""""""""""""
+
+.. code-block:: sql
+
+    CREATE INDEX IDX_entry_starred ON wallabag_entry (is_starred)
+    CREATE INDEX IDX_entry_archived ON wallabag_entry (is_archived)
+
+Migration down
+""""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX IDX_entry_starred
+    DROP INDEX IDX_entry_archived
+
+SQLite
+^^^^^^
+
+Migration up
+""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX uid
+    DROP INDEX created_at
+    DROP INDEX IDX_F4D18282A76ED395
+    CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM wallabag_entry
+    DROP TABLE wallabag_entry
+    CREATE TABLE wallabag_entry (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, 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, language CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT '0', http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, PRIMARY KEY(id))
+    INSERT INTO wallabag_entry (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status) SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM __temp__wallabag_entry
+    DROP TABLE __temp__wallabag_entry
+    CREATE INDEX uid ON wallabag_entry (uid)
+    CREATE INDEX created_at ON wallabag_entry (created_at)
+    CREATE INDEX IDX_F4D18282A76ED395 ON wallabag_entry (user_id)
+    CREATE INDEX IDX_entry_starred ON wallabag_entry (is_starred)
+    CREATE INDEX IDX_entry_archived ON wallabag_entry (is_archived)
+
+Migration down
+""""""""""""""
+
+.. code-block:: sql
+
+    DROP INDEX IDX_entry_archived
+    DROP INDEX IDX_entry_starred
+    DROP INDEX IDX_F4D18282A76ED395
+    DROP INDEX created_at
+    DROP INDEX uid
+    CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM wallabag_entry
+    DROP TABLE wallabag_entry
+    CREATE TABLE wallabag_entry (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, 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, language CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT '0', http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, PRIMARY KEY(id))
+    INSERT INTO wallabag_entry (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status) SELECT id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status FROM __temp__wallabag_entry
+    DROP TABLE __temp__wallabag_entry
+    CREATE INDEX IDX_F4D18282A76ED395 ON wallabag_entry (user_id)
+    CREATE INDEX created_at ON wallabag_entry (created_at)
+    CREATE INDEX uid ON wallabag_entry (uid)
index 088b19a00570cbba163d203af75ac6478856d1fb..2ca5d127daad088142bb6af284160acb71edbfa3 100644 (file)
@@ -37,6 +37,11 @@ Voici la liste des migrations de la 2.1.x à la 2.2.0 :
 * ``20161118134328``: ajout du champ ``http_status`` sur la table ``entry``
 * ``20161122144743``: ajout du paramètre interne pour activer/désactiver la récupération d'articles derrière un paywall
 * ``20161122203647``: suppression des champs ``expired`` et ``credentials_expired`` sur la table ``user``
+* ``20161128084725``: ajout du champ ``list_mode`` sur la table ``config``
+* ``20161128131503``: suppression des champs ``locked``, ``credentials_expire_at`` et ``expires_at`` sur la table ``user``
+* ``20161214094402``: renommage du champ ``uuid`` en ``uid`` sur la table ``entry``
+* ``20161214094403``: ajout de l'index ``uid`` sur la table ``entry``
+* ``20170127093841``: ajout des index ``is_starred`` et ``is_archived`` sur la table ``entry``
 
 Mise à jour sur un hébergement mutualisé
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^