Page MenuHomePhabricator

Fixup Postgres Database changes section for 1.36
Closed, ResolvedPublic

Description

From what I can see, various changes to the Postgres DB Updater have been mixed in with the 1.35 ones... And no 1.36 section has been added

From git diff REL1_35...master includes/installer/PostgresUpdater.php

diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php
index 328e1abe2a..8f8afc5b5f 100644
--- a/includes/installer/PostgresUpdater.php
+++ b/includes/installer/PostgresUpdater.php
@@ -225,7 +225,6 @@ class PostgresUpdater extends DatabaseUpdater {
                        [ 'changeField', 'revision', 'rev_deleted', 'smallint', 'rev_deleted::smallint DEFAULT 0' ],
                        [ 'changeField', 'revision', 'rev_minor_edit', 'smallint',
                                'rev_minor_edit::smallint DEFAULT 0' ],
-                       [ 'changeField', 'templatelinks', 'tl_namespace', 'smallint', 'tl_namespace::smallint' ],
                        [ 'changeField', 'user_newtalk', 'user_ip', 'text', 'host(user_ip)' ],
                        [ 'changeField', 'uploadstash', 'us_image_bits', 'smallint', '' ],
 
@@ -247,12 +246,10 @@ class PostgresUpdater extends DatabaseUpdater {
                        [ 'addPgIndex', 'ipblocks', 'ipb_parent_block_id', '(ipb_parent_block_id)' ],
                        [ 'addPgIndex', 'oldimage', 'oi_sha1', '(oi_sha1)' ],
                        [ 'addPgIndex', 'page', 'page_mediawiki_title', '(page_title) WHERE page_namespace = 8' ],
-                       [ 'addPgIndex', 'pagelinks', 'pagelinks_title', '(pl_title)' ],
                        [ 'addPgIndex', 'page_props', 'pp_propname_page', '(pp_propname, pp_page)' ],
                        [ 'ifFieldExists', 'revision', 'rev_text_id',
                                'addPgIndex', 'revision', 'rev_text_id_idx', '(rev_text_id)' ],
                        [ 'addPgIndex', 'recentchanges', 'rc_timestamp_bot', '(rc_timestamp) WHERE rc_bot = 0' ],
-                       [ 'addPgIndex', 'templatelinks', 'templatelinks_from', '(tl_from)' ],
                        [ 'addPgIndex', 'watchlist', 'wl_user', '(wl_user)' ],
                        [ 'addPgIndex', 'watchlist', 'wl_user_notificationtimestamp',
                                '(wl_user, wl_notificationtimestamp)' ],
@@ -271,12 +268,6 @@ class PostgresUpdater extends DatabaseUpdater {
                        [ 'ifTableNotExists', 'actor', 'addPgIndex', 'logging', 'logging_user_text_time',
                                '(log_user_text, log_timestamp)' ],
 
-                       [ 'checkIndex', 'pagelink_unique', [
-                               [ 'pl_from', 'int4_ops', 'btree', 0 ],
-                               [ 'pl_namespace', 'int2_ops', 'btree', 0 ],
-                               [ 'pl_title', 'text_ops', 'btree', 0 ],
-                       ],
-                               'CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)' ],
                        [ 'checkIndex', 'cl_sortkey', [
                                [ 'cl_to', 'text_ops', 'btree', 0 ],
                                [ 'cl_sortkey', 'text_ops', 'btree', 0 ],
@@ -376,7 +367,6 @@ class PostgresUpdater extends DatabaseUpdater {
                                'mwuser(user_id) ON DELETE SET NULL' ],
                        [ 'ifTableNotExists', 'actor', 'changeFkeyDeferrable', 'image', 'img_user',
                                'mwuser(user_id) ON DELETE SET NULL' ],
-                       [ 'changeFkeyDeferrable', 'imagelinks', 'il_from', 'page(page_id) ON DELETE CASCADE' ],
                        [ 'ifTableNotExists', 'actor', 'changeFkeyDeferrable', 'ipblocks', 'ipb_by',
                                'mwuser(user_id) ON DELETE CASCADE' ],
                        [ 'changeFkeyDeferrable', 'ipblocks', 'ipb_user', 'mwuser(user_id) ON DELETE SET NULL' ],
@@ -401,7 +391,6 @@ class PostgresUpdater extends DatabaseUpdater {
                        [ 'changeFkeyDeferrable', 'revision', 'rev_page', 'page (page_id) ON DELETE CASCADE' ],
                        [ 'ifFieldExists', 'revision', 'rev_text_id',
                                'changeFkeyDeferrable', 'revision', 'rev_user', 'mwuser(user_id) ON DELETE RESTRICT' ],
-                       [ 'changeFkeyDeferrable', 'templatelinks', 'tl_from', 'page(page_id) ON DELETE CASCADE' ],
                        [ 'changeFkeyDeferrable', 'user_groups', 'ug_user', 'mwuser(user_id) ON DELETE CASCADE' ],
                        [ 'changeFkeyDeferrable', 'user_newtalk', 'user_id', 'mwuser(user_id) ON DELETE CASCADE' ],
                        [ 'changeFkeyDeferrable', 'user_properties', 'up_user',
@@ -697,6 +686,52 @@ class PostgresUpdater extends DatabaseUpdater {
                        [ 'changeField', 'actor', 'actor_name', 'TEXT', '' ],
                        [ 'changeField', 'user_former_groups', 'ufg_group', 'TEXT', '' ],
                        [ 'dropFkey', 'user_former_groups', 'ufg_user' ],
+                       [ 'setDefault', 'bot_passwords', 'bp_token', '' ],
+                       [ 'changeField', 'comment', 'comment_id', 'BIGINT', '' ],
+                       [ 'changeField', 'slots', 'slot_revision_id', 'BIGINT', '' ],
+                       [ 'changeField', 'slots', 'slot_content_id', 'BIGINT', '' ],
+                       [ 'changeField', 'slots', 'slot_origin', 'BIGINT', '' ],
+                       [ 'changeField', 'site_stats', 'ss_total_edits', 'BIGINT', '' ],
+                       [ 'changeField', 'site_stats', 'ss_good_articles', 'BIGINT', '' ],
+                       [ 'changeField', 'site_stats', 'ss_total_pages', 'BIGINT', '' ],
+                       [ 'changeField', 'site_stats', 'ss_users', 'BIGINT', '' ],
+                       [ 'changeField', 'site_stats', 'ss_active_users', 'BIGINT', '' ],
+                       [ 'changeField', 'site_stats', 'ss_images', 'BIGINT', '' ],
+                       [ 'dropFkey', 'user_properties', 'up_user' ],
+                       [ 'addIndex', 'user_properties', 'user_properties_pkey', 'patch-user_properties-pk.sql' ],
+                       [ 'changeField', 'log_search', 'ls_value', 'VARCHAR(255)', '' ],
+                       [ 'changeField', 'content', 'content_id', 'BIGINT', '' ],
+                       [ 'changeField', 'l10n_cache', 'lc_value', 'TEXT', '' ],
+                       [ 'changeField', 'l10n_cache', 'lc_key', 'VARCHAR(255)', '' ],
+                       [ 'addIndex', 'l10n_cache', 'l10n_cache_pkey', 'patch-l10n_cache-pk.sql' ],
+                       [ 'addIndex', 'module_deps', 'module_deps_pkey', 'patch-module_deps-pk.sql' ],
+                       [ 'changeField', 'redirect', 'rd_namespace', 'INT', 'rd_namespace::INT DEFAULT 0' ],
+                       [ 'setDefault', 'redirect', 'rd_title', '' ],
+                       [ 'setDefault', 'redirect', 'rd_from', 0 ],
+                       [ 'dropFkey', 'redirect', 'rd_from' ],
+                       [ 'changeField', 'redirect', 'rd_interwiki', 'VARCHAR(32)', '' ],
+                       [ 'dropFkey', 'pagelinks', 'pl_from' ],
+                       [ 'changeField', 'pagelinks', 'pl_namespace', 'INT', 'pl_namespace::INT DEFAULT 0' ],
+                       [ 'setDefault', 'pagelinks', 'pl_title', '' ],
+                       [ 'addPgIndex', 'pagelinks', 'pl_namespace', '(pl_namespace,pl_title,pl_from)' ],
+                       [ 'addPgIndex', 'pagelinks', 'pl_backlinks_namespace',
+                               '(pl_from_namespace,pl_namespace,pl_title,pl_from)' ],
+                       [ 'dropPgIndex', 'pagelinks', 'pagelink_unique' ],
+                       [ 'dropPgIndex', 'pagelinks', 'pagelinks_title' ],
+                       [ 'dropFkey', 'templatelinks', 'tl_from' ],
+                       [ 'changeField', 'templatelinks', 'tl_namespace', 'INT', 'tl_namespace::INT DEFAULT 0' ],
+                       [ 'setDefault', 'templatelinks', 'tl_title', '' ],
+                       [ 'addPgIndex', 'templatelinks', 'tl_namespace', '(tl_namespace,tl_title,tl_from)' ],
+                       [ 'addPgIndex', 'templatelinks', 'tl_backlinks_namespace',
+                               '(tl_from_namespace,tl_namespace,tl_title,tl_from)' ],
+                       [ 'dropPgIndex', 'templatelinks', 'templatelinks_unique' ],
+                       [ 'dropPgIndex', 'templatelinks', 'templatelinks_from' ],
+                       [ 'dropFkey', 'imagelinks', 'il_from' ],
+                       [ 'setDefault', 'imagelinks', 'il_to', '' ],
+                       [ 'addPgIndex', 'imagelinks', 'il_to', '(il_to, il_from)' ],
+                       [ 'addPgIndex', 'imagelinks', 'il_backlinks_namespace',
+                               '(il_from_namespace, il_to, il_from)' ],
+                       [ 'dropPgIndex', 'imagelinks', 'il_from' ],
                ];
        }

MySQL/SQLite done in rMW155ce7a4fdf7: Add 1.36 Database Updater sections for MySQL/SQLite as they were easy

Event Timeline

So we need to add a section marker for 1.36 at start of the additions but the removals are correct, e.g. if you remove a foreign key with:

[ 'dropFkey', 'imagelinks', 'il_from' ],

You need to remove the part that introduces it otherwise in every update.php run (on master), you end up with the foreign key being added and then removed.

i.e. what you did with MySQL and Sqlite should be enough here too.

Change 622422 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[mediawiki/core@master] Add 1.36 Database Updater sections for Postgres

https://gerrit.wikimedia.org/r/622422

Change 622422 merged by jenkins-bot:
[mediawiki/core@master] Add 1.36 Database Updater sections for Postgres

https://gerrit.wikimedia.org/r/622422

Ladsgroup claimed this task.

Let's call it done.