X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FPostgresUpdater.php;h=a3b50ac565bedf0ba9f3e0f9b4bc5aea5ed27015;hb=6f5751aa3a3a2ec981d7aebd45791a18dbd8b4e3;hp=21d5dbc4bc17d963cbfa50e13bbda92832a6650b;hpb=48fdd531c8cf294b39e4f0ea2b3d06f742c197c7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index 21d5dbc4bc..a3b50ac565 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -40,431 +40,436 @@ class PostgresUpdater extends DatabaseUpdater { * @return array */ protected function getCoreUpdateList() { - return array( + return [ # rename tables 1.7.3 # r15791 Change reserved word table names "user" and "text" - array( 'renameTable', 'user', 'mwuser' ), - array( 'renameTable', 'text', 'pagecontent' ), - array( 'renameIndex', 'mwuser', 'user_pkey', 'mwuser_pkey' ), - array( 'renameIndex', 'mwuser', 'user_user_name_key', 'mwuser_user_name_key' ), - array( 'renameIndex', 'pagecontent', 'text_pkey', 'pagecontent_pkey' ), + [ 'renameTable', 'user', 'mwuser' ], + [ 'renameTable', 'text', 'pagecontent' ], + [ 'renameIndex', 'mwuser', 'user_pkey', 'mwuser_pkey' ], + [ 'renameIndex', 'mwuser', 'user_user_name_key', 'mwuser_user_name_key' ], + [ 'renameIndex', 'pagecontent', 'text_pkey', 'pagecontent_pkey' ], # renamed sequences - array( 'renameSequence', 'ipblocks_ipb_id_val', 'ipblocks_ipb_id_seq' ), - array( 'renameSequence', 'rev_rev_id_val', 'revision_rev_id_seq' ), - array( 'renameSequence', 'text_old_id_val', 'text_old_id_seq' ), - array( 'renameSequence', 'rc_rc_id_seq', 'recentchanges_rc_id_seq' ), - array( 'renameSequence', 'log_log_id_seq', 'logging_log_id_seq' ), - array( 'renameSequence', 'pr_id_val', 'page_restrictions_pr_id_seq' ), - array( 'renameSequence', 'us_id_seq', 'uploadstash_us_id_seq' ), + [ 'renameSequence', 'ipblocks_ipb_id_val', 'ipblocks_ipb_id_seq' ], + [ 'renameSequence', 'rev_rev_id_val', 'revision_rev_id_seq' ], + [ 'renameSequence', 'text_old_id_val', 'text_old_id_seq' ], + [ 'renameSequence', 'rc_rc_id_seq', 'recentchanges_rc_id_seq' ], + [ 'renameSequence', 'log_log_id_seq', 'logging_log_id_seq' ], + [ 'renameSequence', 'pr_id_val', 'page_restrictions_pr_id_seq' ], + [ 'renameSequence', 'us_id_seq', 'uploadstash_us_id_seq' ], # since r58263 - array( 'renameSequence', 'category_id_seq', 'category_cat_id_seq' ), + [ 'renameSequence', 'category_id_seq', 'category_cat_id_seq' ], # new sequences if not renamed above - array( 'addSequence', 'logging', false, 'logging_log_id_seq' ), - array( 'addSequence', 'page_restrictions', false, 'page_restrictions_pr_id_seq' ), - array( 'addSequence', 'filearchive', 'fa_id', 'filearchive_fa_id_seq' ), - array( 'addSequence', 'archive', false, 'archive_ar_id_seq' ), - array( 'addSequence', 'externallinks', false, 'externallinks_el_id_seq' ), + [ 'addSequence', 'logging', false, 'logging_log_id_seq' ], + [ 'addSequence', 'page_restrictions', false, 'page_restrictions_pr_id_seq' ], + [ 'addSequence', 'filearchive', 'fa_id', 'filearchive_fa_id_seq' ], + [ 'addSequence', 'archive', false, 'archive_ar_id_seq' ], + [ 'addSequence', 'externallinks', false, 'externallinks_el_id_seq' ], + [ 'addSequence', 'watchlist', false, 'watchlist_wl_id_seq' ], # new tables - array( 'addTable', 'category', 'patch-category.sql' ), - array( 'addTable', 'page', 'patch-page.sql' ), - array( 'addTable', 'querycachetwo', 'patch-querycachetwo.sql' ), - array( 'addTable', 'page_props', 'patch-page_props.sql' ), - array( 'addTable', 'page_restrictions', 'patch-page_restrictions.sql' ), - array( 'addTable', 'profiling', 'patch-profiling.sql' ), - array( 'addTable', 'protected_titles', 'patch-protected_titles.sql' ), - array( 'addTable', 'redirect', 'patch-redirect.sql' ), - array( 'addTable', 'updatelog', 'patch-updatelog.sql' ), - array( 'addTable', 'change_tag', 'patch-change_tag.sql' ), - array( 'addTable', 'tag_summary', 'patch-tag_summary.sql' ), - array( 'addTable', 'valid_tag', 'patch-valid_tag.sql' ), - array( 'addTable', 'user_properties', 'patch-user_properties.sql' ), - array( 'addTable', 'log_search', 'patch-log_search.sql' ), - array( 'addTable', 'l10n_cache', 'patch-l10n_cache.sql' ), - array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ), - array( 'addTable', 'module_deps', 'patch-module_deps.sql' ), - array( 'addTable', 'uploadstash', 'patch-uploadstash.sql' ), - array( 'addTable', 'user_former_groups', 'patch-user_former_groups.sql' ), - array( 'addTable', 'sites', 'patch-sites.sql' ), - array( 'addTable', 'bot_passwords', 'patch-bot_passwords.sql' ), + [ 'addTable', 'category', 'patch-category.sql' ], + [ 'addTable', 'page', 'patch-page.sql' ], + [ 'addTable', 'querycachetwo', 'patch-querycachetwo.sql' ], + [ 'addTable', 'page_props', 'patch-page_props.sql' ], + [ 'addTable', 'page_restrictions', 'patch-page_restrictions.sql' ], + [ 'addTable', 'profiling', 'patch-profiling.sql' ], + [ 'addTable', 'protected_titles', 'patch-protected_titles.sql' ], + [ 'addTable', 'redirect', 'patch-redirect.sql' ], + [ 'addTable', 'updatelog', 'patch-updatelog.sql' ], + [ 'addTable', 'change_tag', 'patch-change_tag.sql' ], + [ 'addTable', 'tag_summary', 'patch-tag_summary.sql' ], + [ 'addTable', 'valid_tag', 'patch-valid_tag.sql' ], + [ 'addTable', 'user_properties', 'patch-user_properties.sql' ], + [ 'addTable', 'log_search', 'patch-log_search.sql' ], + [ 'addTable', 'l10n_cache', 'patch-l10n_cache.sql' ], + [ 'addTable', 'iwlinks', 'patch-iwlinks.sql' ], + [ 'addTable', 'module_deps', 'patch-module_deps.sql' ], + [ 'addTable', 'uploadstash', 'patch-uploadstash.sql' ], + [ 'addTable', 'user_former_groups', 'patch-user_former_groups.sql' ], + [ 'addTable', 'sites', 'patch-sites.sql' ], + [ 'addTable', 'bot_passwords', 'patch-bot_passwords.sql' ], # Needed before new field - array( 'convertArchive2' ), + [ 'convertArchive2' ], # new fields - array( 'addPgField', 'updatelog', 'ul_value', 'TEXT' ), - array( 'addPgField', 'archive', 'ar_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), - array( 'addPgField', 'archive', 'ar_len', 'INTEGER' ), - array( 'addPgField', 'archive', 'ar_page_id', 'INTEGER' ), - array( 'addPgField', 'archive', 'ar_parent_id', 'INTEGER' ), - array( 'addPgField', 'archive', 'ar_content_model', 'TEXT' ), - array( 'addPgField', 'archive', 'ar_content_format', 'TEXT' ), - array( 'addPgField', 'categorylinks', 'cl_sortkey_prefix', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'categorylinks', 'cl_collation', "TEXT NOT NULL DEFAULT 0" ), - array( 'addPgField', 'categorylinks', 'cl_type', "TEXT NOT NULL DEFAULT 'page'" ), - array( 'addPgField', 'image', 'img_sha1', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'ipblocks', 'ipb_allow_usertalk', 'SMALLINT NOT NULL DEFAULT 0' ), - array( 'addPgField', 'ipblocks', 'ipb_anon_only', 'SMALLINT NOT NULL DEFAULT 0' ), - array( 'addPgField', 'ipblocks', 'ipb_by_text', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'ipblocks', 'ipb_block_email', 'SMALLINT NOT NULL DEFAULT 0' ), - array( 'addPgField', 'ipblocks', 'ipb_create_account', 'SMALLINT NOT NULL DEFAULT 1' ), - array( 'addPgField', 'ipblocks', 'ipb_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), - array( 'addPgField', 'ipblocks', 'ipb_enable_autoblock', 'SMALLINT NOT NULL DEFAULT 1' ), - array( 'addPgField', 'ipblocks', 'ipb_parent_block_id', + [ 'addPgField', 'updatelog', 'ul_value', 'TEXT' ], + [ 'addPgField', 'archive', 'ar_deleted', 'SMALLINT NOT NULL DEFAULT 0' ], + [ 'addPgField', 'archive', 'ar_len', 'INTEGER' ], + [ 'addPgField', 'archive', 'ar_page_id', 'INTEGER' ], + [ 'addPgField', 'archive', 'ar_parent_id', 'INTEGER' ], + [ 'addPgField', 'archive', 'ar_content_model', 'TEXT' ], + [ 'addPgField', 'archive', 'ar_content_format', 'TEXT' ], + [ 'addPgField', 'categorylinks', 'cl_sortkey_prefix', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'categorylinks', 'cl_collation', "TEXT NOT NULL DEFAULT 0" ], + [ 'addPgField', 'categorylinks', 'cl_type', "TEXT NOT NULL DEFAULT 'page'" ], + [ 'addPgField', 'image', 'img_sha1', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'ipblocks', 'ipb_allow_usertalk', 'SMALLINT NOT NULL DEFAULT 0' ], + [ 'addPgField', 'ipblocks', 'ipb_anon_only', 'SMALLINT NOT NULL DEFAULT 0' ], + [ 'addPgField', 'ipblocks', 'ipb_by_text', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'ipblocks', 'ipb_block_email', 'SMALLINT NOT NULL DEFAULT 0' ], + [ 'addPgField', 'ipblocks', 'ipb_create_account', 'SMALLINT NOT NULL DEFAULT 1' ], + [ 'addPgField', 'ipblocks', 'ipb_deleted', 'SMALLINT NOT NULL DEFAULT 0' ], + [ 'addPgField', 'ipblocks', 'ipb_enable_autoblock', 'SMALLINT NOT NULL DEFAULT 1' ], + [ 'addPgField', 'ipblocks', 'ipb_parent_block_id', 'INTEGER DEFAULT NULL REFERENCES ipblocks(ipb_id) ' . - 'ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED' ), - array( 'addPgField', 'filearchive', 'fa_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), - array( 'addPgField', 'filearchive', 'fa_sha1', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'logging', 'log_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), - array( 'addPgField', 'logging', 'log_id', - "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('logging_log_id_seq')" ), - array( 'addPgField', 'logging', 'log_params', 'TEXT' ), - array( 'addPgField', 'mwuser', 'user_editcount', 'INTEGER' ), - array( 'addPgField', 'mwuser', 'user_newpass_time', 'TIMESTAMPTZ' ), - array( 'addPgField', 'oldimage', 'oi_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), - array( 'addPgField', 'oldimage', 'oi_major_mime', "TEXT NOT NULL DEFAULT 'unknown'" ), - array( 'addPgField', 'oldimage', 'oi_media_type', 'TEXT' ), - array( 'addPgField', 'oldimage', 'oi_metadata', "BYTEA NOT NULL DEFAULT ''" ), - array( 'addPgField', 'oldimage', 'oi_minor_mime', "TEXT NOT NULL DEFAULT 'unknown'" ), - array( 'addPgField', 'oldimage', 'oi_sha1', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'page', 'page_content_model', 'TEXT' ), - array( 'addPgField', 'page_restrictions', 'pr_id', - "INTEGER NOT NULL UNIQUE DEFAULT nextval('page_restrictions_pr_id_seq')" ), - array( 'addPgField', 'profiling', 'pf_memory', 'NUMERIC(18,10) NOT NULL DEFAULT 0' ), - array( 'addPgField', 'recentchanges', 'rc_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), - array( 'addPgField', 'recentchanges', 'rc_log_action', 'TEXT' ), - array( 'addPgField', 'recentchanges', 'rc_log_type', 'TEXT' ), - array( 'addPgField', 'recentchanges', 'rc_logid', 'INTEGER NOT NULL DEFAULT 0' ), - array( 'addPgField', 'recentchanges', 'rc_new_len', 'INTEGER' ), - array( 'addPgField', 'recentchanges', 'rc_old_len', 'INTEGER' ), - array( 'addPgField', 'recentchanges', 'rc_params', 'TEXT' ), - array( 'addPgField', 'redirect', 'rd_interwiki', 'TEXT NULL' ), - array( 'addPgField', 'redirect', 'rd_fragment', 'TEXT NULL' ), - array( 'addPgField', 'revision', 'rev_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), - array( 'addPgField', 'revision', 'rev_len', 'INTEGER' ), - array( 'addPgField', 'revision', 'rev_parent_id', 'INTEGER DEFAULT NULL' ), - array( 'addPgField', 'revision', 'rev_content_model', 'TEXT' ), - array( 'addPgField', 'revision', 'rev_content_format', 'TEXT' ), - array( 'addPgField', 'site_stats', 'ss_active_users', "INTEGER DEFAULT '-1'" ), - array( 'addPgField', 'user_newtalk', 'user_last_timestamp', 'TIMESTAMPTZ' ), - array( 'addPgField', 'logging', 'log_user_text', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'logging', 'log_page', 'INTEGER' ), - array( 'addPgField', 'interwiki', 'iw_api', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'interwiki', 'iw_wikiid', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'revision', 'rev_sha1', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'archive', 'ar_sha1', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'uploadstash', 'us_chunk_inx', "INTEGER NULL" ), - array( 'addPgField', 'job', 'job_timestamp', "TIMESTAMPTZ" ), - array( 'addPgField', 'job', 'job_random', "INTEGER NOT NULL DEFAULT 0" ), - array( 'addPgField', 'job', 'job_attempts', "INTEGER NOT NULL DEFAULT 0" ), - array( 'addPgField', 'job', 'job_token', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'job', 'job_token_timestamp', "TIMESTAMPTZ" ), - array( 'addPgField', 'job', 'job_sha1', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'archive', 'ar_id', - "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('archive_ar_id_seq')" ), - array( 'addPgField', 'externallinks', 'el_id', - "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('externallinks_el_id_seq')" ), - array( 'addPgField', 'uploadstash', 'us_props', "BYTEA" ), + 'ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED' ], + [ 'addPgField', 'filearchive', 'fa_deleted', 'SMALLINT NOT NULL DEFAULT 0' ], + [ 'addPgField', 'filearchive', 'fa_sha1', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'logging', 'log_deleted', 'SMALLINT NOT NULL DEFAULT 0' ], + [ 'addPgField', 'logging', 'log_id', + "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('logging_log_id_seq')" ], + [ 'addPgField', 'logging', 'log_params', 'TEXT' ], + [ 'addPgField', 'mwuser', 'user_editcount', 'INTEGER' ], + [ 'addPgField', 'mwuser', 'user_newpass_time', 'TIMESTAMPTZ' ], + [ 'addPgField', 'oldimage', 'oi_deleted', 'SMALLINT NOT NULL DEFAULT 0' ], + [ 'addPgField', 'oldimage', 'oi_major_mime', "TEXT NOT NULL DEFAULT 'unknown'" ], + [ 'addPgField', 'oldimage', 'oi_media_type', 'TEXT' ], + [ 'addPgField', 'oldimage', 'oi_metadata', "BYTEA NOT NULL DEFAULT ''" ], + [ 'addPgField', 'oldimage', 'oi_minor_mime', "TEXT NOT NULL DEFAULT 'unknown'" ], + [ 'addPgField', 'oldimage', 'oi_sha1', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'page', 'page_content_model', 'TEXT' ], + [ 'addPgField', 'page_restrictions', 'pr_id', + "INTEGER NOT NULL UNIQUE DEFAULT nextval('page_restrictions_pr_id_seq')" ], + [ 'addPgField', 'profiling', 'pf_memory', 'NUMERIC(18,10) NOT NULL DEFAULT 0' ], + [ 'addPgField', 'recentchanges', 'rc_deleted', 'SMALLINT NOT NULL DEFAULT 0' ], + [ 'addPgField', 'recentchanges', 'rc_log_action', 'TEXT' ], + [ 'addPgField', 'recentchanges', 'rc_log_type', 'TEXT' ], + [ 'addPgField', 'recentchanges', 'rc_logid', 'INTEGER NOT NULL DEFAULT 0' ], + [ 'addPgField', 'recentchanges', 'rc_new_len', 'INTEGER' ], + [ 'addPgField', 'recentchanges', 'rc_old_len', 'INTEGER' ], + [ 'addPgField', 'recentchanges', 'rc_params', 'TEXT' ], + [ 'addPgField', 'redirect', 'rd_interwiki', 'TEXT NULL' ], + [ 'addPgField', 'redirect', 'rd_fragment', 'TEXT NULL' ], + [ 'addPgField', 'revision', 'rev_deleted', 'SMALLINT NOT NULL DEFAULT 0' ], + [ 'addPgField', 'revision', 'rev_len', 'INTEGER' ], + [ 'addPgField', 'revision', 'rev_parent_id', 'INTEGER DEFAULT NULL' ], + [ 'addPgField', 'revision', 'rev_content_model', 'TEXT' ], + [ 'addPgField', 'revision', 'rev_content_format', 'TEXT' ], + [ 'addPgField', 'site_stats', 'ss_active_users', "INTEGER DEFAULT '-1'" ], + [ 'addPgField', 'user_newtalk', 'user_last_timestamp', 'TIMESTAMPTZ' ], + [ 'addPgField', 'logging', 'log_user_text', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'logging', 'log_page', 'INTEGER' ], + [ 'addPgField', 'interwiki', 'iw_api', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'interwiki', 'iw_wikiid', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'revision', 'rev_sha1', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'archive', 'ar_sha1', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'uploadstash', 'us_chunk_inx', "INTEGER NULL" ], + [ 'addPgField', 'job', 'job_timestamp', "TIMESTAMPTZ" ], + [ 'addPgField', 'job', 'job_random', "INTEGER NOT NULL DEFAULT 0" ], + [ 'addPgField', 'job', 'job_attempts', "INTEGER NOT NULL DEFAULT 0" ], + [ 'addPgField', 'job', 'job_token', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'job', 'job_token_timestamp', "TIMESTAMPTZ" ], + [ 'addPgField', 'job', 'job_sha1', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'archive', 'ar_id', + "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('archive_ar_id_seq')" ], + [ 'addPgField', 'externallinks', 'el_id', + "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('externallinks_el_id_seq')" ], + [ 'addPgField', 'uploadstash', 'us_props', "BYTEA" ], # type changes - array( 'changeField', 'archive', 'ar_deleted', 'smallint', '' ), - array( 'changeField', 'archive', 'ar_minor_edit', 'smallint', - 'ar_minor_edit::smallint DEFAULT 0' ), - array( 'changeField', 'filearchive', 'fa_deleted', 'smallint', '' ), - array( 'changeField', 'filearchive', 'fa_height', 'integer', '' ), - array( 'changeField', 'filearchive', 'fa_metadata', 'bytea', "decode(fa_metadata,'escape')" ), - array( 'changeField', 'filearchive', 'fa_size', 'integer', '' ), - array( 'changeField', 'filearchive', 'fa_width', 'integer', '' ), - array( 'changeField', 'filearchive', 'fa_storage_group', 'text', '' ), - array( 'changeField', 'filearchive', 'fa_storage_key', 'text', '' ), - array( 'changeField', 'image', 'img_metadata', 'bytea', "decode(img_metadata,'escape')" ), - array( 'changeField', 'image', 'img_size', 'integer', '' ), - array( 'changeField', 'image', 'img_width', 'integer', '' ), - array( 'changeField', 'image', 'img_height', 'integer', '' ), - array( 'changeField', 'interwiki', 'iw_local', 'smallint', 'iw_local::smallint' ), - array( 'changeField', 'interwiki', 'iw_trans', 'smallint', 'iw_trans::smallint DEFAULT 0' ), - array( 'changeField', 'ipblocks', 'ipb_auto', 'smallint', 'ipb_auto::smallint DEFAULT 0' ), - array( 'changeField', 'ipblocks', 'ipb_anon_only', 'smallint', - "CASE WHEN ipb_anon_only=' ' THEN 0 ELSE ipb_anon_only::smallint END DEFAULT 0" ), - array( 'changeField', 'ipblocks', 'ipb_create_account', 'smallint', - "CASE WHEN ipb_create_account=' ' THEN 0 ELSE ipb_create_account::smallint END DEFAULT 1" ), - array( 'changeField', 'ipblocks', 'ipb_enable_autoblock', 'smallint', - "CASE WHEN ipb_enable_autoblock=' ' THEN 0 ELSE ipb_enable_autoblock::smallint END DEFAULT 1" ), - array( 'changeField', 'ipblocks', 'ipb_block_email', 'smallint', - "CASE WHEN ipb_block_email=' ' THEN 0 ELSE ipb_block_email::smallint END DEFAULT 0" ), - array( 'changeField', 'ipblocks', 'ipb_address', 'text', 'ipb_address::text' ), - array( 'changeField', 'ipblocks', 'ipb_deleted', 'smallint', 'ipb_deleted::smallint DEFAULT 0' ), - array( 'changeField', 'mwuser', 'user_token', 'text', '' ), - array( 'changeField', 'mwuser', 'user_email_token', 'text', '' ), - array( 'changeField', 'objectcache', 'keyname', 'text', '' ), - array( 'changeField', 'oldimage', 'oi_height', 'integer', '' ), - array( 'changeField', 'oldimage', 'oi_metadata', 'bytea', "decode(img_metadata,'escape')" ), - array( 'changeField', 'oldimage', 'oi_size', 'integer', '' ), - array( 'changeField', 'oldimage', 'oi_width', 'integer', '' ), - array( 'changeField', 'page', 'page_is_redirect', 'smallint', - 'page_is_redirect::smallint DEFAULT 0' ), - array( 'changeField', 'page', 'page_is_new', 'smallint', 'page_is_new::smallint DEFAULT 0' ), - array( 'changeField', 'querycache', 'qc_value', 'integer', '' ), - array( 'changeField', 'querycachetwo', 'qcc_value', 'integer', '' ), - array( 'changeField', 'recentchanges', 'rc_bot', 'smallint', 'rc_bot::smallint DEFAULT 0' ), - array( 'changeField', 'recentchanges', 'rc_deleted', 'smallint', '' ), - array( 'changeField', 'recentchanges', 'rc_minor', 'smallint', 'rc_minor::smallint DEFAULT 0' ), - array( 'changeField', 'recentchanges', 'rc_new', 'smallint', 'rc_new::smallint DEFAULT 0' ), - array( 'changeField', 'recentchanges', 'rc_type', 'smallint', 'rc_type::smallint DEFAULT 0' ), - array( 'changeField', 'recentchanges', 'rc_patrolled', 'smallint', - 'rc_patrolled::smallint DEFAULT 0' ), - array( 'changeField', 'revision', 'rev_deleted', 'smallint', 'rev_deleted::smallint DEFAULT 0' ), - array( 'changeField', 'revision', 'rev_minor_edit', 'smallint', - 'rev_minor_edit::smallint DEFAULT 0' ), - array( 'changeField', 'templatelinks', 'tl_namespace', 'smallint', 'tl_namespace::smallint' ), - array( 'changeField', 'user_newtalk', 'user_ip', 'text', 'host(user_ip)' ), - array( 'changeField', 'uploadstash', 'us_image_bits', 'smallint', '' ), - array( 'changeField', 'profiling', 'pf_time', 'float', '' ), - array( 'changeField', 'profiling', 'pf_memory', 'float', '' ), + [ 'changeField', 'archive', 'ar_deleted', 'smallint', '' ], + [ 'changeField', 'archive', 'ar_minor_edit', 'smallint', + 'ar_minor_edit::smallint DEFAULT 0' ], + [ 'changeField', 'filearchive', 'fa_deleted', 'smallint', '' ], + [ 'changeField', 'filearchive', 'fa_height', 'integer', '' ], + [ 'changeField', 'filearchive', 'fa_metadata', 'bytea', "decode(fa_metadata,'escape')" ], + [ 'changeField', 'filearchive', 'fa_size', 'integer', '' ], + [ 'changeField', 'filearchive', 'fa_width', 'integer', '' ], + [ 'changeField', 'filearchive', 'fa_storage_group', 'text', '' ], + [ 'changeField', 'filearchive', 'fa_storage_key', 'text', '' ], + [ 'changeField', 'image', 'img_metadata', 'bytea', "decode(img_metadata,'escape')" ], + [ 'changeField', 'image', 'img_size', 'integer', '' ], + [ 'changeField', 'image', 'img_width', 'integer', '' ], + [ 'changeField', 'image', 'img_height', 'integer', '' ], + [ 'changeField', 'interwiki', 'iw_local', 'smallint', 'iw_local::smallint' ], + [ 'changeField', 'interwiki', 'iw_trans', 'smallint', 'iw_trans::smallint DEFAULT 0' ], + [ 'changeField', 'ipblocks', 'ipb_auto', 'smallint', 'ipb_auto::smallint DEFAULT 0' ], + [ 'changeField', 'ipblocks', 'ipb_anon_only', 'smallint', + "CASE WHEN ipb_anon_only=' ' THEN 0 ELSE ipb_anon_only::smallint END DEFAULT 0" ], + [ 'changeField', 'ipblocks', 'ipb_create_account', 'smallint', + "CASE WHEN ipb_create_account=' ' THEN 0 ELSE ipb_create_account::smallint END DEFAULT 1" ], + [ 'changeField', 'ipblocks', 'ipb_enable_autoblock', 'smallint', + "CASE WHEN ipb_enable_autoblock=' ' THEN 0 ELSE ipb_enable_autoblock::smallint END DEFAULT 1" ], + [ 'changeField', 'ipblocks', 'ipb_block_email', 'smallint', + "CASE WHEN ipb_block_email=' ' THEN 0 ELSE ipb_block_email::smallint END DEFAULT 0" ], + [ 'changeField', 'ipblocks', 'ipb_address', 'text', 'ipb_address::text' ], + [ 'changeField', 'ipblocks', 'ipb_deleted', 'smallint', 'ipb_deleted::smallint DEFAULT 0' ], + [ 'changeField', 'mwuser', 'user_token', 'text', '' ], + [ 'changeField', 'mwuser', 'user_email_token', 'text', '' ], + [ 'changeField', 'objectcache', 'keyname', 'text', '' ], + [ 'changeField', 'oldimage', 'oi_height', 'integer', '' ], + [ 'changeField', 'oldimage', 'oi_metadata', 'bytea', "decode(img_metadata,'escape')" ], + [ 'changeField', 'oldimage', 'oi_size', 'integer', '' ], + [ 'changeField', 'oldimage', 'oi_width', 'integer', '' ], + [ 'changeField', 'page', 'page_is_redirect', 'smallint', + 'page_is_redirect::smallint DEFAULT 0' ], + [ 'changeField', 'page', 'page_is_new', 'smallint', 'page_is_new::smallint DEFAULT 0' ], + [ 'changeField', 'querycache', 'qc_value', 'integer', '' ], + [ 'changeField', 'querycachetwo', 'qcc_value', 'integer', '' ], + [ 'changeField', 'recentchanges', 'rc_bot', 'smallint', 'rc_bot::smallint DEFAULT 0' ], + [ 'changeField', 'recentchanges', 'rc_deleted', 'smallint', '' ], + [ 'changeField', 'recentchanges', 'rc_minor', 'smallint', 'rc_minor::smallint DEFAULT 0' ], + [ 'changeField', 'recentchanges', 'rc_new', 'smallint', 'rc_new::smallint DEFAULT 0' ], + [ 'changeField', 'recentchanges', 'rc_type', 'smallint', 'rc_type::smallint DEFAULT 0' ], + [ 'changeField', 'recentchanges', 'rc_patrolled', 'smallint', + 'rc_patrolled::smallint DEFAULT 0' ], + [ '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', '' ], + [ 'changeField', 'profiling', 'pf_time', 'float', '' ], + [ 'changeField', 'profiling', 'pf_memory', 'float', '' ], # null changes - array( 'changeNullableField', 'oldimage', 'oi_bits', 'NULL' ), - array( 'changeNullableField', 'oldimage', 'oi_timestamp', 'NULL' ), - array( 'changeNullableField', 'oldimage', 'oi_major_mime', 'NULL' ), - array( 'changeNullableField', 'oldimage', 'oi_minor_mime', 'NULL' ), - array( 'changeNullableField', 'image', 'img_metadata', 'NOT NULL' ), - array( 'changeNullableField', 'filearchive', 'fa_metadata', 'NOT NULL' ), - array( 'changeNullableField', 'recentchanges', 'rc_cur_id', 'NULL' ), - array( 'changeNullableField', 'recentchanges', 'rc_cur_time', 'NULL' ), + [ 'changeNullableField', 'oldimage', 'oi_bits', 'NULL' ], + [ 'changeNullableField', 'oldimage', 'oi_timestamp', 'NULL' ], + [ 'changeNullableField', 'oldimage', 'oi_major_mime', 'NULL' ], + [ 'changeNullableField', 'oldimage', 'oi_minor_mime', 'NULL' ], + [ 'changeNullableField', 'image', 'img_metadata', 'NOT NULL' ], + [ 'changeNullableField', 'filearchive', 'fa_metadata', 'NOT NULL' ], + [ 'changeNullableField', 'recentchanges', 'rc_cur_id', 'NULL' ], + [ 'changeNullableField', 'recentchanges', 'rc_cur_time', 'NULL' ], - array( 'checkOiDeleted' ), + [ 'checkOiDeleted' ], # New indexes - array( 'addPgIndex', 'archive', 'archive_user_text', '(ar_user_text)' ), - array( 'addPgIndex', 'image', 'img_sha1', '(img_sha1)' ), - array( 'addPgIndex', 'ipblocks', 'ipb_parent_block_id', '(ipb_parent_block_id)' ), - array( 'addPgIndex', 'oldimage', 'oi_sha1', '(oi_sha1)' ), - array( 'addPgIndex', 'page', 'page_mediawiki_title', '(page_title) WHERE page_namespace = 8' ), - array( 'addPgIndex', 'pagelinks', 'pagelinks_title', '(pl_title)' ), - array( 'addPgIndex', 'page_props', 'pp_propname_page', '(pp_propname, pp_page)' ), - array( 'addPgIndex', 'revision', 'rev_text_id_idx', '(rev_text_id)' ), - array( 'addPgIndex', 'recentchanges', 'rc_timestamp_bot', '(rc_timestamp) WHERE rc_bot = 0' ), - array( 'addPgIndex', 'templatelinks', 'templatelinks_from', '(tl_from)' ), - array( 'addPgIndex', 'watchlist', 'wl_user', '(wl_user)' ), - array( 'addPgIndex', 'watchlist', 'wl_user_notificationtimestamp', - '(wl_user, wl_notificationtimestamp)' ), - array( 'addPgIndex', 'logging', 'logging_user_type_time', - '(log_user, log_type, log_timestamp)' ), - array( 'addPgIndex', 'logging', 'logging_page_id_time', '(log_page,log_timestamp)' ), - array( 'addPgIndex', 'iwlinks', 'iwl_prefix_from_title', '(iwl_prefix, iwl_from, iwl_title)' ), - array( 'addPgIndex', 'iwlinks', 'iwl_prefix_title_from', '(iwl_prefix, iwl_title, iwl_from)' ), - array( 'addPgIndex', 'job', 'job_timestamp_idx', '(job_timestamp)' ), - array( 'addPgIndex', 'job', 'job_sha1', '(job_sha1)' ), - array( 'addPgIndex', 'job', 'job_cmd_token', '(job_cmd, job_token, job_random)' ), - array( 'addPgIndex', 'job', 'job_cmd_token_id', '(job_cmd, job_token, job_id)' ), - array( 'addPgIndex', 'filearchive', 'fa_sha1', '(fa_sha1)' ), - array( 'addPgIndex', 'logging', 'logging_user_text_type_time', - '(log_user_text, log_type, log_timestamp)' ), - array( 'addPgIndex', 'logging', 'logging_user_text_time', '(log_user_text, log_timestamp)' ), - - array( 'checkIndex', 'pagelink_unique', array( - array( 'pl_from', 'int4_ops', 'btree', 0 ), - array( 'pl_namespace', 'int2_ops', 'btree', 0 ), - array( 'pl_title', 'text_ops', 'btree', 0 ), - ), - 'CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)' ), - array( 'checkIndex', 'cl_sortkey', array( - array( 'cl_to', 'text_ops', 'btree', 0 ), - array( 'cl_sortkey', 'text_ops', 'btree', 0 ), - array( 'cl_from', 'int4_ops', 'btree', 0 ), - ), + [ 'addPgIndex', 'archive', 'archive_user_text', '(ar_user_text)' ], + [ 'addPgIndex', 'image', 'img_sha1', '(img_sha1)' ], + [ '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)' ], + [ '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)' ], + [ 'addPgIndex', 'logging', 'logging_user_type_time', + '(log_user, log_type, log_timestamp)' ], + [ 'addPgIndex', 'logging', 'logging_page_id_time', '(log_page,log_timestamp)' ], + [ 'addPgIndex', 'iwlinks', 'iwl_prefix_from_title', '(iwl_prefix, iwl_from, iwl_title)' ], + [ 'addPgIndex', 'iwlinks', 'iwl_prefix_title_from', '(iwl_prefix, iwl_title, iwl_from)' ], + [ 'addPgIndex', 'job', 'job_timestamp_idx', '(job_timestamp)' ], + [ 'addPgIndex', 'job', 'job_sha1', '(job_sha1)' ], + [ 'addPgIndex', 'job', 'job_cmd_token', '(job_cmd, job_token, job_random)' ], + [ 'addPgIndex', 'job', 'job_cmd_token_id', '(job_cmd, job_token, job_id)' ], + [ 'addPgIndex', 'filearchive', 'fa_sha1', '(fa_sha1)' ], + [ 'addPgIndex', 'logging', 'logging_user_text_type_time', + '(log_user_text, log_type, log_timestamp)' ], + [ '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 ], + [ 'cl_from', 'int4_ops', 'btree', 0 ], + ], 'CREATE INDEX cl_sortkey ON "categorylinks" ' . - 'USING "btree" ("cl_to", "cl_sortkey", "cl_from")' ), - array( 'checkIndex', 'iwl_prefix_title_from', array( - array( 'iwl_prefix', 'text_ops', 'btree', 0 ), - array( 'iwl_title', 'text_ops', 'btree', 0 ), - array( 'iwl_from', 'int4_ops', 'btree', 0 ), - ), + 'USING "btree" ("cl_to", "cl_sortkey", "cl_from")' ], + [ 'checkIndex', 'iwl_prefix_title_from', [ + [ 'iwl_prefix', 'text_ops', 'btree', 0 ], + [ 'iwl_title', 'text_ops', 'btree', 0 ], + [ 'iwl_from', 'int4_ops', 'btree', 0 ], + ], 'CREATE INDEX iwl_prefix_title_from ON "iwlinks" ' . - 'USING "btree" ("iwl_prefix", "iwl_title", "iwl_from")' ), - array( 'checkIndex', 'logging_times', array( - array( 'log_timestamp', 'timestamptz_ops', 'btree', 0 ), - ), - 'CREATE INDEX "logging_times" ON "logging" USING "btree" ("log_timestamp")' ), - array( 'dropIndex', 'oldimage', 'oi_name' ), - array( 'checkIndex', 'oi_name_archive_name', array( - array( 'oi_name', 'text_ops', 'btree', 0 ), - array( 'oi_archive_name', 'text_ops', 'btree', 0 ), - ), + 'USING "btree" ("iwl_prefix", "iwl_title", "iwl_from")' ], + [ 'checkIndex', 'logging_times', [ + [ 'log_timestamp', 'timestamptz_ops', 'btree', 0 ], + ], + 'CREATE INDEX "logging_times" ON "logging" USING "btree" ("log_timestamp")' ], + [ 'dropIndex', 'oldimage', 'oi_name' ], + [ 'checkIndex', 'oi_name_archive_name', [ + [ 'oi_name', 'text_ops', 'btree', 0 ], + [ 'oi_archive_name', 'text_ops', 'btree', 0 ], + ], 'CREATE INDEX "oi_name_archive_name" ON "oldimage" ' . - 'USING "btree" ("oi_name", "oi_archive_name")' ), - array( 'checkIndex', 'oi_name_timestamp', array( - array( 'oi_name', 'text_ops', 'btree', 0 ), - array( 'oi_timestamp', 'timestamptz_ops', 'btree', 0 ), - ), + 'USING "btree" ("oi_name", "oi_archive_name")' ], + [ 'checkIndex', 'oi_name_timestamp', [ + [ 'oi_name', 'text_ops', 'btree', 0 ], + [ 'oi_timestamp', 'timestamptz_ops', 'btree', 0 ], + ], 'CREATE INDEX "oi_name_timestamp" ON "oldimage" ' . - 'USING "btree" ("oi_name", "oi_timestamp")' ), - array( 'checkIndex', 'page_main_title', array( - array( 'page_title', 'text_pattern_ops', 'btree', 0 ), - ), + 'USING "btree" ("oi_name", "oi_timestamp")' ], + [ 'checkIndex', 'page_main_title', [ + [ 'page_title', 'text_pattern_ops', 'btree', 0 ], + ], 'CREATE INDEX "page_main_title" ON "page" ' . - 'USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 0)' ), - array( 'checkIndex', 'page_mediawiki_title', array( - array( 'page_title', 'text_pattern_ops', 'btree', 0 ), - ), + 'USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 0)' ], + [ 'checkIndex', 'page_mediawiki_title', [ + [ 'page_title', 'text_pattern_ops', 'btree', 0 ], + ], 'CREATE INDEX "page_mediawiki_title" ON "page" ' . - 'USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 8)' ), - array( 'checkIndex', 'page_project_title', array( - array( 'page_title', 'text_pattern_ops', 'btree', 0 ), - ), + 'USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 8)' ], + [ 'checkIndex', 'page_project_title', [ + [ 'page_title', 'text_pattern_ops', 'btree', 0 ], + ], 'CREATE INDEX "page_project_title" ON "page" ' . 'USING "btree" ("page_title" "text_pattern_ops") ' . - 'WHERE ("page_namespace" = 4)' ), - array( 'checkIndex', 'page_talk_title', array( - array( 'page_title', 'text_pattern_ops', 'btree', 0 ), - ), + 'WHERE ("page_namespace" = 4)' ], + [ 'checkIndex', 'page_talk_title', [ + [ 'page_title', 'text_pattern_ops', 'btree', 0 ], + ], 'CREATE INDEX "page_talk_title" ON "page" ' . 'USING "btree" ("page_title" "text_pattern_ops") ' . - 'WHERE ("page_namespace" = 1)' ), - array( 'checkIndex', 'page_user_title', array( - array( 'page_title', 'text_pattern_ops', 'btree', 0 ), - ), + 'WHERE ("page_namespace" = 1)' ], + [ 'checkIndex', 'page_user_title', [ + [ 'page_title', 'text_pattern_ops', 'btree', 0 ], + ], 'CREATE INDEX "page_user_title" ON "page" ' . 'USING "btree" ("page_title" "text_pattern_ops") WHERE ' . - '("page_namespace" = 2)' ), - array( 'checkIndex', 'page_utalk_title', array( - array( 'page_title', 'text_pattern_ops', 'btree', 0 ), - ), + '("page_namespace" = 2)' ], + [ 'checkIndex', 'page_utalk_title', [ + [ 'page_title', 'text_pattern_ops', 'btree', 0 ], + ], 'CREATE INDEX "page_utalk_title" ON "page" ' . 'USING "btree" ("page_title" "text_pattern_ops") ' . - 'WHERE ("page_namespace" = 3)' ), - array( 'checkIndex', 'ts2_page_text', array( - array( 'textvector', 'tsvector_ops', 'gist', 0 ), - ), - 'CREATE INDEX "ts2_page_text" ON "pagecontent" USING "gist" ("textvector")' ), - array( 'checkIndex', 'ts2_page_title', array( - array( 'titlevector', 'tsvector_ops', 'gist', 0 ), - ), - 'CREATE INDEX "ts2_page_title" ON "page" USING "gist" ("titlevector")' ), - - array( 'checkOiNameConstraint' ), - array( 'checkPageDeletedTrigger' ), - array( 'checkRevUserFkey' ), - array( 'dropIndex', 'ipblocks', 'ipb_address' ), - array( 'checkIndex', 'ipb_address_unique', array( - array( 'ipb_address', 'text_ops', 'btree', 0 ), - array( 'ipb_user', 'int4_ops', 'btree', 0 ), - array( 'ipb_auto', 'int2_ops', 'btree', 0 ), - array( 'ipb_anon_only', 'int2_ops', 'btree', 0 ), - ), + 'WHERE ("page_namespace" = 3)' ], + [ 'checkIndex', 'ts2_page_text', [ + [ 'textvector', 'tsvector_ops', 'gist', 0 ], + ], + 'CREATE INDEX "ts2_page_text" ON "pagecontent" USING "gist" ("textvector")' ], + [ 'checkIndex', 'ts2_page_title', [ + [ 'titlevector', 'tsvector_ops', 'gist', 0 ], + ], + 'CREATE INDEX "ts2_page_title" ON "page" USING "gist" ("titlevector")' ], + + [ 'checkOiNameConstraint' ], + [ 'checkPageDeletedTrigger' ], + [ 'checkRevUserFkey' ], + [ 'dropIndex', 'ipblocks', 'ipb_address' ], + [ 'checkIndex', 'ipb_address_unique', [ + [ 'ipb_address', 'text_ops', 'btree', 0 ], + [ 'ipb_user', 'int4_ops', 'btree', 0 ], + [ 'ipb_auto', 'int2_ops', 'btree', 0 ], + [ 'ipb_anon_only', 'int2_ops', 'btree', 0 ], + ], 'CREATE UNIQUE INDEX ipb_address_unique ' . - 'ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only)' ), + 'ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only)' ], - array( 'checkIwlPrefix' ), + [ 'checkIwlPrefix' ], # All FK columns should be deferred - array( 'changeFkeyDeferrable', 'archive', 'ar_user', 'mwuser(user_id) ON DELETE SET NULL' ), - array( 'changeFkeyDeferrable', 'categorylinks', 'cl_from', 'page(page_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'externallinks', 'el_from', 'page(page_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'filearchive', 'fa_deleted_user', - 'mwuser(user_id) ON DELETE SET NULL' ), - array( 'changeFkeyDeferrable', 'filearchive', 'fa_user', 'mwuser(user_id) ON DELETE SET NULL' ), - array( 'changeFkeyDeferrable', 'image', 'img_user', 'mwuser(user_id) ON DELETE SET NULL' ), - array( 'changeFkeyDeferrable', 'imagelinks', 'il_from', 'page(page_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'ipblocks', 'ipb_by', 'mwuser(user_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'ipblocks', 'ipb_user', 'mwuser(user_id) ON DELETE SET NULL' ), - array( 'changeFkeyDeferrable', 'ipblocks', 'ipb_parent_block_id', - 'ipblocks(ipb_id) ON DELETE SET NULL' ), - array( 'changeFkeyDeferrable', 'langlinks', 'll_from', 'page(page_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'logging', 'log_user', 'mwuser(user_id) ON DELETE SET NULL' ), - array( 'changeFkeyDeferrable', 'oldimage', 'oi_name', - 'image(img_name) ON DELETE CASCADE ON UPDATE CASCADE' ), - array( 'changeFkeyDeferrable', 'oldimage', 'oi_user', 'mwuser(user_id) ON DELETE SET NULL' ), - array( 'changeFkeyDeferrable', 'pagelinks', 'pl_from', 'page(page_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'page_props', 'pp_page', 'page (page_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'page_restrictions', 'pr_page', - 'page(page_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'protected_titles', 'pt_user', - 'mwuser(user_id) ON DELETE SET NULL' ), - array( 'changeFkeyDeferrable', 'recentchanges', 'rc_user', - 'mwuser(user_id) ON DELETE SET NULL' ), - array( 'changeFkeyDeferrable', 'redirect', 'rd_from', 'page(page_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'revision', 'rev_page', 'page (page_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'revision', 'rev_user', 'mwuser(user_id) ON DELETE RESTRICT' ), - array( 'changeFkeyDeferrable', 'templatelinks', 'tl_from', 'page(page_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'user_groups', 'ug_user', 'mwuser(user_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'user_newtalk', 'user_id', 'mwuser(user_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'user_properties', 'up_user', - 'mwuser(user_id) ON DELETE CASCADE' ), - array( 'changeFkeyDeferrable', 'watchlist', 'wl_user', 'mwuser(user_id) ON DELETE CASCADE' ), + [ 'changeFkeyDeferrable', 'archive', 'ar_user', 'mwuser(user_id) ON DELETE SET NULL' ], + [ 'changeFkeyDeferrable', 'categorylinks', 'cl_from', 'page(page_id) ON DELETE CASCADE' ], + [ 'changeFkeyDeferrable', 'externallinks', 'el_from', 'page(page_id) ON DELETE CASCADE' ], + [ 'changeFkeyDeferrable', 'filearchive', 'fa_deleted_user', + 'mwuser(user_id) ON DELETE SET NULL' ], + [ 'changeFkeyDeferrable', 'filearchive', 'fa_user', 'mwuser(user_id) ON DELETE SET NULL' ], + [ 'changeFkeyDeferrable', 'image', 'img_user', 'mwuser(user_id) ON DELETE SET NULL' ], + [ 'changeFkeyDeferrable', 'imagelinks', 'il_from', 'page(page_id) ON DELETE CASCADE' ], + [ 'changeFkeyDeferrable', 'ipblocks', 'ipb_by', 'mwuser(user_id) ON DELETE CASCADE' ], + [ 'changeFkeyDeferrable', 'ipblocks', 'ipb_user', 'mwuser(user_id) ON DELETE SET NULL' ], + [ 'changeFkeyDeferrable', 'ipblocks', 'ipb_parent_block_id', + 'ipblocks(ipb_id) ON DELETE SET NULL' ], + [ 'changeFkeyDeferrable', 'langlinks', 'll_from', 'page(page_id) ON DELETE CASCADE' ], + [ 'changeFkeyDeferrable', 'logging', 'log_user', 'mwuser(user_id) ON DELETE SET NULL' ], + [ 'changeFkeyDeferrable', 'oldimage', 'oi_name', + 'image(img_name) ON DELETE CASCADE ON UPDATE CASCADE' ], + [ 'changeFkeyDeferrable', 'oldimage', 'oi_user', 'mwuser(user_id) ON DELETE SET NULL' ], + [ 'changeFkeyDeferrable', 'pagelinks', 'pl_from', 'page(page_id) ON DELETE CASCADE' ], + [ 'changeFkeyDeferrable', 'page_props', 'pp_page', 'page (page_id) ON DELETE CASCADE' ], + [ 'changeFkeyDeferrable', 'page_restrictions', 'pr_page', + 'page(page_id) ON DELETE CASCADE' ], + [ 'changeFkeyDeferrable', 'protected_titles', 'pt_user', + 'mwuser(user_id) ON DELETE SET NULL' ], + [ 'changeFkeyDeferrable', 'recentchanges', 'rc_user', + 'mwuser(user_id) ON DELETE SET NULL' ], + [ 'changeFkeyDeferrable', 'redirect', 'rd_from', 'page(page_id) ON DELETE CASCADE' ], + [ 'changeFkeyDeferrable', 'revision', 'rev_page', 'page (page_id) ON DELETE CASCADE' ], + [ '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', + 'mwuser(user_id) ON DELETE CASCADE' ], + [ 'changeFkeyDeferrable', 'watchlist', 'wl_user', 'mwuser(user_id) ON DELETE CASCADE' ], # r81574 - array( 'addInterwikiType' ), + [ 'addInterwikiType' ], # end - array( 'tsearchFixes' ), + [ 'tsearchFixes' ], // 1.23 - array( 'addPgField', 'recentchanges', 'rc_source', "TEXT NOT NULL DEFAULT ''" ), - array( 'addPgField', 'page', 'page_links_updated', "TIMESTAMPTZ NULL" ), - array( 'addPgField', 'mwuser', 'user_password_expires', 'TIMESTAMPTZ NULL' ), - array( 'changeFieldPurgeTable', 'l10n_cache', 'lc_value', 'bytea', - "replace(lc_value,'\','\\\\')::bytea" ), + [ 'addPgField', 'recentchanges', 'rc_source', "TEXT NOT NULL DEFAULT ''" ], + [ 'addPgField', 'page', 'page_links_updated', "TIMESTAMPTZ NULL" ], + [ 'addPgField', 'mwuser', 'user_password_expires', 'TIMESTAMPTZ NULL' ], + [ 'changeFieldPurgeTable', 'l10n_cache', 'lc_value', 'bytea', + "replace(lc_value,'\','\\\\')::bytea" ], // 1.23.9 - array( 'rebuildTextSearch' ), + [ 'rebuildTextSearch' ], // 1.24 - array( 'addPgField', 'page_props', 'pp_sortkey', 'float NULL' ), - array( 'addPgIndex', 'page_props', 'pp_propname_sortkey_page', - '( pp_propname, pp_sortkey, pp_page ) WHERE ( pp_sortkey IS NOT NULL )' ), - array( 'addPgField', 'page', 'page_lang', 'TEXT default NULL' ), - array( 'addPgField', 'pagelinks', 'pl_from_namespace', 'INTEGER NOT NULL DEFAULT 0' ), - array( 'addPgField', 'templatelinks', 'tl_from_namespace', 'INTEGER NOT NULL DEFAULT 0' ), - array( 'addPgField', 'imagelinks', 'il_from_namespace', 'INTEGER NOT NULL DEFAULT 0' ), + [ 'addPgField', 'page_props', 'pp_sortkey', 'float NULL' ], + [ 'addPgIndex', 'page_props', 'pp_propname_sortkey_page', + '( pp_propname, pp_sortkey, pp_page ) WHERE ( pp_sortkey IS NOT NULL )' ], + [ 'addPgField', 'page', 'page_lang', 'TEXT default NULL' ], + [ 'addPgField', 'pagelinks', 'pl_from_namespace', 'INTEGER NOT NULL DEFAULT 0' ], + [ 'addPgField', 'templatelinks', 'tl_from_namespace', 'INTEGER NOT NULL DEFAULT 0' ], + [ 'addPgField', 'imagelinks', 'il_from_namespace', 'INTEGER NOT NULL DEFAULT 0' ], // 1.25 - array( 'dropTable', 'hitcounter' ), - array( 'dropField', 'site_stats', 'ss_total_views', 'patch-drop-ss_total_views.sql' ), - array( 'dropField', 'page', 'page_counter', 'patch-drop-page_counter.sql' ), - array( 'dropFkey', 'recentchanges', 'rc_cur_id' ), + [ 'dropTable', 'hitcounter' ], + [ 'dropField', 'site_stats', 'ss_total_views', 'patch-drop-ss_total_views.sql' ], + [ 'dropField', 'page', 'page_counter', 'patch-drop-page_counter.sql' ], + [ 'dropFkey', 'recentchanges', 'rc_cur_id' ], // 1.27 - array( 'dropTable', 'msg_resource_links' ), - array( 'dropTable', 'msg_resource' ), - ); + [ 'dropTable', 'msg_resource_links' ], + [ 'dropTable', 'msg_resource' ], + [ + 'addPgField', 'watchlist', 'wl_id', + "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('watchlist_wl_id_seq')" + ], + ]; } protected function getOldGlobalUpdates() { global $wgExtNewTables, $wgExtPGNewFields, $wgExtPGAlteredFields, $wgExtNewIndexes; - $updates = array(); + $updates = []; # Add missing extension tables foreach ( $wgExtNewTables as $tableRecord ) { - $updates[] = array( + $updates[] = [ 'addTable', $tableRecord[0], $tableRecord[1], true - ); + ]; } # Add missing extension fields foreach ( $wgExtPGNewFields as $fieldRecord ) { - $updates[] = array( + $updates[] = [ 'addPgField', $fieldRecord[0], $fieldRecord[1], $fieldRecord[2] - ); + ]; } # Change altered columns foreach ( $wgExtPGAlteredFields as $fieldRecord ) { - $updates[] = array( + $updates[] = [ 'changeField', $fieldRecord[0], $fieldRecord[1], $fieldRecord[2] - ); + ]; } # Add missing extension indexes foreach ( $wgExtNewIndexes as $fieldRecord ) { - $updates[] = array( + $updates[] = [ 'addPgExtIndex', $fieldRecord[0], $fieldRecord[1], $fieldRecord[2] - ); + ]; } return $updates; @@ -484,12 +489,12 @@ END; return null; } - $cols = array(); + $cols = []; foreach ( $res as $r ) { - $cols[] = array( + $cols[] = [ "name" => $r[0], "ord" => $r[1], - ); + ]; } return $cols; @@ -524,7 +529,7 @@ END; $relid = intval( $r[1] ); $indkeys = explode( ' ', $indkey ); - $colnames = array(); + $colnames = []; foreach ( $indkeys as $rid ) { $query = <<output( "Changing column type of '$table.$field' from '{$fi->type()}' to '$newtype'\n" ); $sql = "ALTER TABLE $table ALTER $field TYPE $newtype"; if ( strlen( $default ) ) { - $res = array(); + $res = []; if ( preg_match( '/DEFAULT (.+)/', $default, $res ) ) { $sqldef = "ALTER TABLE $table ALTER $field SET DEFAULT $res[1]"; $this->db->query( $sqldef ); @@ -714,7 +719,7 @@ END; $this->output( "Changing column type of '$table.$field' from '{$fi->type()}' to '$newtype'\n" ); $sql = "ALTER TABLE $table ALTER $field TYPE $newtype"; if ( strlen( $default ) ) { - $res = array(); + $res = []; if ( preg_match( '/DEFAULT (.+)/', $default, $res ) ) { $sqldef = "ALTER TABLE $table ALTER $field SET DEFAULT $res[1]"; $this->db->query( $sqldef ); @@ -905,7 +910,7 @@ END; if ( !empty( $pu ) && $pu != $should_be ) { $this->output( "Dropping obsolete version of index '$index'\n" ); $this->db->query( "DROP INDEX \"" . $index . "\"" ); - $pu = array(); + $pu = []; } else { $this->output( "...no need to drop index '$index'\n" ); }