diff options
Diffstat (limited to 'maintenance/ibm_db2')
29 files changed, 273 insertions, 13 deletions
diff --git a/maintenance/ibm_db2/patch-categorylinks-better-collation.sql b/maintenance/ibm_db2/patch-categorylinks-better-collation.sql new file mode 100644 index 00000000..312583ac --- /dev/null +++ b/maintenance/ibm_db2/patch-categorylinks-better-collation.sql @@ -0,0 +1,21 @@ +-- +-- patch-categorylinks-better-collation.sql +-- +-- +-- Track category inclusions *used inline* +-- This tracks a single level of category membership +-- (folksonomic tagging, really). +-- +CREATE TABLE categorylinks ( + cl_from BIGINT NOT NULL DEFAULT 0, + -- REFERENCES page(page_id) ON DELETE CASCADE, + cl_to VARCHAR(255) NOT NULL, + -- cl_sortkey has to be at least 86 wide + -- in order to be compatible with the old MySQL schema from MW 1.10 + --cl_sortkey VARCHAR(86), + cl_sortkey VARCHAR(230) FOR BIT DATA NOT NULL , + cl_sortkey_prefix VARCHAR(255) FOR BIT DATA NOT NULL , + cl_timestamp TIMESTAMP(3) NOT NULL, + cl_collation VARCHAR(32) FOR BIT DATA NOT NULL , + cl_type VARCHAR(6) FOR BIT DATA NOT NULL +); diff --git a/maintenance/ibm_db2/patch-change_tag-indexes.sql b/maintenance/ibm_db2/patch-change_tag-indexes.sql new file mode 100644 index 00000000..1621a038 --- /dev/null +++ b/maintenance/ibm_db2/patch-change_tag-indexes.sql @@ -0,0 +1,5 @@ +CREATE UNIQUE INDEX change_tag_rc_tag ON change_tag (ct_rc_id,ct_tag); +CREATE UNIQUE INDEX change_tag_log_tag ON change_tag (ct_log_id,ct_tag); +CREATE UNIQUE INDEX change_tag_rev_tag ON change_tag (ct_rev_id,ct_tag); +-- Covering index, so we can pull all the info only out of the index. +CREATE INDEX change_tag_tag_id ON change_tag (ct_tag,ct_rc_id,ct_rev_id,ct_log_id); diff --git a/maintenance/ibm_db2/patch-change_tag.sql b/maintenance/ibm_db2/patch-change_tag.sql new file mode 100644 index 00000000..3b6f9d54 --- /dev/null +++ b/maintenance/ibm_db2/patch-change_tag.sql @@ -0,0 +1,8 @@ +-- A table to track tags for revisions, logs and recent changes. +CREATE TABLE change_tag ( + ct_rc_id INTEGER, + ct_log_id INTEGER, + ct_rev_id INTEGER, + ct_tag varchar(255) NOT NULL, + ct_params CLOB(64K) INLINE LENGTH 4096 +); diff --git a/maintenance/ibm_db2/patch-change_tag_summary.sql b/maintenance/ibm_db2/patch-change_tag_summary.sql new file mode 100644 index 00000000..768cbfaa --- /dev/null +++ b/maintenance/ibm_db2/patch-change_tag_summary.sql @@ -0,0 +1,7 @@ +-- Rollup table to pull a LIST of tags simply +CREATE TABLE tag_summary ( + ts_rc_id INTEGER, + ts_log_id INTEGER, + ts_rev_id INTEGER, + ts_tags CLOB(64K) INLINE LENGTH 4096 NOT NULL +); diff --git a/maintenance/ibm_db2/patch-change_valid_tag.sql b/maintenance/ibm_db2/patch-change_valid_tag.sql new file mode 100644 index 00000000..9bdcbc92 --- /dev/null +++ b/maintenance/ibm_db2/patch-change_valid_tag.sql @@ -0,0 +1,3 @@ +CREATE TABLE valid_tag ( + vt_tag varchar(255) NOT NULL PRIMARY KEY +); diff --git a/maintenance/ibm_db2/patch-cl_collation-field.sql b/maintenance/ibm_db2/patch-cl_collation-field.sql new file mode 100644 index 00000000..6999dace --- /dev/null +++ b/maintenance/ibm_db2/patch-cl_collation-field.sql @@ -0,0 +1 @@ +ALTER TABLE categorylinks ADD cl_collation VARCHAR(32) FOR BIT DATA NOT NULL diff --git a/maintenance/ibm_db2/patch-cl_sortkey_prefix-field.sql b/maintenance/ibm_db2/patch-cl_sortkey_prefix-field.sql new file mode 100644 index 00000000..58b78147 --- /dev/null +++ b/maintenance/ibm_db2/patch-cl_sortkey_prefix-field.sql @@ -0,0 +1 @@ +ALTER TABLE categorylinks ADD cl_sortkey_prefix VARCHAR(255) FOR BIT DATA NOT NULL diff --git a/maintenance/ibm_db2/patch-cl_type-field.sql b/maintenance/ibm_db2/patch-cl_type-field.sql new file mode 100644 index 00000000..5952c989 --- /dev/null +++ b/maintenance/ibm_db2/patch-cl_type-field.sql @@ -0,0 +1 @@ +ALTER TABLE categorylinks ADD cl_type VARCHAR(6) FOR BIT DATA NOT NULL diff --git a/maintenance/ibm_db2/patch-external_user.sql b/maintenance/ibm_db2/patch-external_user.sql new file mode 100644 index 00000000..96cb8237 --- /dev/null +++ b/maintenance/ibm_db2/patch-external_user.sql @@ -0,0 +1,7 @@ +CREATE TABLE external_user ( + -- Foreign key to user_id + eu_local_id BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1), + + -- Some opaque identifier provided by the external database + eu_external_id VARCHAR(255) NOT NULL +); diff --git a/maintenance/ibm_db2/patch-ipb_allow_usertalk.sql b/maintenance/ibm_db2/patch-ipb_allow_usertalk.sql new file mode 100644 index 00000000..6274bb22 --- /dev/null +++ b/maintenance/ibm_db2/patch-ipb_allow_usertalk.sql @@ -0,0 +1,23 @@ +CREATE TABLE ipblocks ( + ipb_id INTEGER NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1), + --DEFAULT nextval('ipblocks_ipb_id_val'), + ipb_address VARCHAR(1024), + ipb_user BIGINT NOT NULL DEFAULT 0, + -- REFERENCES user(user_id) ON DELETE SET NULL, + ipb_by BIGINT NOT NULL DEFAULT 0, + -- REFERENCES user(user_id) ON DELETE CASCADE, + ipb_by_text VARCHAR(255) NOT NULL DEFAULT '', + ipb_reason VARCHAR(1024) NOT NULL, + ipb_timestamp TIMESTAMP(3) NOT NULL, + ipb_auto SMALLINT NOT NULL DEFAULT 0, + ipb_anon_only SMALLINT NOT NULL DEFAULT 0, + ipb_create_account SMALLINT NOT NULL DEFAULT 1, + ipb_enable_autoblock SMALLINT NOT NULL DEFAULT 1, + ipb_expiry TIMESTAMP(3) NOT NULL, + ipb_range_start VARCHAR(1024), + ipb_range_end VARCHAR(1024), + ipb_deleted SMALLINT NOT NULL DEFAULT 0, + ipb_block_email SMALLINT NOT NULL DEFAULT 0, + ipb_allow_usertalk SMALLINT NOT NULL DEFAULT 0 + +); diff --git a/maintenance/ibm_db2/patch-iw_api-field.sql b/maintenance/ibm_db2/patch-iw_api-field.sql new file mode 100644 index 00000000..dd732a58 --- /dev/null +++ b/maintenance/ibm_db2/patch-iw_api-field.sql @@ -0,0 +1 @@ +ALTER TABLE interwiki ADD iw_api CLOB(64K) INLINE LENGTH 4096 NOT NULL diff --git a/maintenance/ibm_db2/patch-iw_api_and_wikiid.sql b/maintenance/ibm_db2/patch-iw_api_and_wikiid.sql new file mode 100644 index 00000000..1b1e3592 --- /dev/null +++ b/maintenance/ibm_db2/patch-iw_api_and_wikiid.sql @@ -0,0 +1,8 @@ +CREATE TABLE interwiki ( + iw_prefix VARCHAR(32) NOT NULL UNIQUE, + iw_url CLOB(64K) INLINE LENGTH 4096 NOT NULL, + iw_api CLOB(64K) INLINE LENGTH 4096 NOT NULL, + iw_wikiid varchar(64) NOT NULL, + iw_local SMALLINT NOT NULL, + iw_trans SMALLINT NOT NULL DEFAULT 0 +); diff --git a/maintenance/ibm_db2/patch-iw_wikiid-field.sql b/maintenance/ibm_db2/patch-iw_wikiid-field.sql new file mode 100644 index 00000000..fe49e3c0 --- /dev/null +++ b/maintenance/ibm_db2/patch-iw_wikiid-field.sql @@ -0,0 +1 @@ +ALTER TABLE interwiki ADD iw_wikiid varchar(64) NOT NULL diff --git a/maintenance/ibm_db2/patch-iwlinks.sql b/maintenance/ibm_db2/patch-iwlinks.sql new file mode 100644 index 00000000..2902512f --- /dev/null +++ b/maintenance/ibm_db2/patch-iwlinks.sql @@ -0,0 +1,7 @@ +CREATE TABLE "IWLINKS" +( +"IWL_FROM" INT NOT NULL , +"IWL_PREFIX" VARCHAR(20) FOR BIT DATA NOT NULL , +"IWL_TITLE" VARCHAR(255) FOR BIT DATA NOT NULL +) +; diff --git a/maintenance/ibm_db2/patch-l10n_cache.sql b/maintenance/ibm_db2/patch-l10n_cache.sql new file mode 100644 index 00000000..49ebed2b --- /dev/null +++ b/maintenance/ibm_db2/patch-l10n_cache.sql @@ -0,0 +1,8 @@ +CREATE TABLE l10n_cache ( + -- Language code + lc_lang VARCHAR(32) NOT NULL, + -- Cache key + lc_key VARCHAR(255) NOT NULL, + -- Value + lc_value CLOB(16M) INLINE LENGTH 4096 NOT NULL +); diff --git a/maintenance/ibm_db2/patch-log_search-rename-index.sql b/maintenance/ibm_db2/patch-log_search-rename-index.sql new file mode 100644 index 00000000..a6a696e1 --- /dev/null +++ b/maintenance/ibm_db2/patch-log_search-rename-index.sql @@ -0,0 +1,8 @@ +CREATE TABLE log_search ( + -- The type of ID (rev ID, log ID, rev TIMESTAMP(3), username) + ls_field VARCHAR(32) FOR BIT DATA NOT NULL, + -- The value of the ID + ls_value varchar(255) NOT NULL, + -- Key to log_id + ls_log_id BIGINT NOT NULL default 0 +); diff --git a/maintenance/ibm_db2/patch-log_search.sql b/maintenance/ibm_db2/patch-log_search.sql new file mode 100644 index 00000000..a6a696e1 --- /dev/null +++ b/maintenance/ibm_db2/patch-log_search.sql @@ -0,0 +1,8 @@ +CREATE TABLE log_search ( + -- The type of ID (rev ID, log ID, rev TIMESTAMP(3), username) + ls_field VARCHAR(32) FOR BIT DATA NOT NULL, + -- The value of the ID + ls_value varchar(255) NOT NULL, + -- Key to log_id + ls_log_id BIGINT NOT NULL default 0 +); diff --git a/maintenance/ibm_db2/patch-log_user_text.sql b/maintenance/ibm_db2/patch-log_user_text.sql new file mode 100644 index 00000000..3534057a --- /dev/null +++ b/maintenance/ibm_db2/patch-log_user_text.sql @@ -0,0 +1,17 @@ +CREATE TABLE logging ( + log_id BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1), + --PRIMARY KEY DEFAULT nextval('log_log_id_seq'), + log_type VARCHAR(32) NOT NULL, + log_action VARCHAR(32) NOT NULL, + log_timestamp TIMESTAMP(3) NOT NULL, + log_user BIGINT NOT NULL DEFAULT 0, + -- REFERENCES user(user_id) ON DELETE SET NULL, + -- Name of the user who performed this action + log_user_text VARCHAR(255) NOT NULL default '', + log_namespace SMALLINT NOT NULL, + log_title VARCHAR(255) NOT NULL, + log_page BIGINT, + log_comment VARCHAR(255), + log_params CLOB(64K) INLINE LENGTH 4096, + log_deleted SMALLINT NOT NULL DEFAULT 0 +); diff --git a/maintenance/ibm_db2/patch-module_deps.sql b/maintenance/ibm_db2/patch-module_deps.sql new file mode 100644 index 00000000..5058d1f5 --- /dev/null +++ b/maintenance/ibm_db2/patch-module_deps.sql @@ -0,0 +1,6 @@ +CREATE TABLE "MODULE_DEPS" ( +"MD_MODULE" VARCHAR(255) FOR BIT DATA NOT NULL , +"MD_SKIN" VARCHAR(32) FOR BIT DATA NOT NULL , +"MD_DEPS" CLOB(16M) INLINE LENGTH 4096 NOT NULL +) +; diff --git a/maintenance/ibm_db2/patch-msg_resource.sql b/maintenance/ibm_db2/patch-msg_resource.sql new file mode 100644 index 00000000..58b3dd6c --- /dev/null +++ b/maintenance/ibm_db2/patch-msg_resource.sql @@ -0,0 +1,8 @@ +CREATE TABLE "MSG_RESOURCE" +( +"MR_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL , +"MR_LANG" VARCHAR(32) FOR BIT DATA NOT NULL , +"MR_BLOB" BLOB NOT NULL , +"MR_TIMESTAMP" TIMESTAMP(3) NOT NULL +) +; diff --git a/maintenance/ibm_db2/patch-msg_resource_links.sql b/maintenance/ibm_db2/patch-msg_resource_links.sql new file mode 100644 index 00000000..4c0ff918 --- /dev/null +++ b/maintenance/ibm_db2/patch-msg_resource_links.sql @@ -0,0 +1,6 @@ +CREATE TABLE "MSG_RESOURCE_LINKS" +( +"MRL_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL , +"MRL_MESSAGE" VARCHAR(255) FOR BIT DATA NOT NULL +) +; diff --git a/maintenance/ibm_db2/patch-rd_interwiki.sql b/maintenance/ibm_db2/patch-rd_interwiki.sql new file mode 100644 index 00000000..c162548c --- /dev/null +++ b/maintenance/ibm_db2/patch-rd_interwiki.sql @@ -0,0 +1,8 @@ +CREATE TABLE redirect ( + rd_from BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1), + --REFERENCES page(page_id) ON DELETE CASCADE, + rd_namespace SMALLINT NOT NULL DEFAULT 0, + rd_title VARCHAR(255) NOT NULL DEFAULT '', + rd_interwiki varchar(32), + rd_fragment VARCHAR(255) +); diff --git a/maintenance/ibm_db2/patch-ss_active_users.sql b/maintenance/ibm_db2/patch-ss_active_users.sql new file mode 100644 index 00000000..f0e6d145 --- /dev/null +++ b/maintenance/ibm_db2/patch-ss_active_users.sql @@ -0,0 +1,11 @@ +CREATE TABLE site_stats ( + ss_row_id BIGINT NOT NULL UNIQUE, + ss_total_views BIGINT DEFAULT 0, + ss_total_edits BIGINT DEFAULT 0, + ss_good_articles BIGINT DEFAULT 0, + ss_total_pages INTEGER DEFAULT -1, + ss_users INTEGER DEFAULT -1, + ss_active_users INTEGER DEFAULT -1, + ss_admins INTEGER DEFAULT -1, + ss_images INTEGER DEFAULT 0 +); diff --git a/maintenance/ibm_db2/patch-ul_value.sql b/maintenance/ibm_db2/patch-ul_value.sql new file mode 100644 index 00000000..cd00f8e0 --- /dev/null +++ b/maintenance/ibm_db2/patch-ul_value.sql @@ -0,0 +1,3 @@ +CREATE TABLE updatelog ( + ul_key VARCHAR(255) NOT NULL PRIMARY KEY +); diff --git a/maintenance/ibm_db2/patch-uq61_msg_resource_links.sql b/maintenance/ibm_db2/patch-uq61_msg_resource_links.sql new file mode 100644 index 00000000..d9185c0a --- /dev/null +++ b/maintenance/ibm_db2/patch-uq61_msg_resource_links.sql @@ -0,0 +1,7 @@ +CREATE UNIQUE INDEX "UQ61_MSG_RESOURCE_LINKS" ON "MSG_RESOURCE_LINKS" +( +"MRL_MESSAGE", +"MRL_RESOURCE" +) +ALLOW REVERSE SCANS +; diff --git a/maintenance/ibm_db2/patch-uq81_msg_resource.sql b/maintenance/ibm_db2/patch-uq81_msg_resource.sql new file mode 100644 index 00000000..8ed85379 --- /dev/null +++ b/maintenance/ibm_db2/patch-uq81_msg_resource.sql @@ -0,0 +1,7 @@ +CREATE UNIQUE INDEX "UQ81_MSG_RESOURCE" ON "MSG_RESOURCE" +( +"MR_RESOURCE" +,"MR_LANG" +) +ALLOW REVERSE SCANS +; diff --git a/maintenance/ibm_db2/patch-uq96_module_deps.sql b/maintenance/ibm_db2/patch-uq96_module_deps.sql new file mode 100644 index 00000000..e0cc879a --- /dev/null +++ b/maintenance/ibm_db2/patch-uq96_module_deps.sql @@ -0,0 +1,7 @@ +CREATE UNIQUE INDEX "UQ96_MODULE_DEPS" ON "MODULE_DEPS" +( +"MD_MODULE" +,"MD_SKIN" +) +ALLOW REVERSE SCANS +; diff --git a/maintenance/ibm_db2/patch-user_properties.sql b/maintenance/ibm_db2/patch-user_properties.sql new file mode 100644 index 00000000..72dcd792 --- /dev/null +++ b/maintenance/ibm_db2/patch-user_properties.sql @@ -0,0 +1,10 @@ +CREATE TABLE user_properties ( + -- Foreign key to user.user_id + up_user BIGINT NOT NULL, + + -- Name of the option being saved. This is indexed for bulk lookup. + up_property VARCHAR(32) FOR BIT DATA NOT NULL, + + -- Property value as a string. + up_value CLOB(64K) INLINE LENGTH 4096 +); diff --git a/maintenance/ibm_db2/tables.sql b/maintenance/ibm_db2/tables.sql index 546c871d..261a3a2b 100644 --- a/maintenance/ibm_db2/tables.sql +++ b/maintenance/ibm_db2/tables.sql @@ -9,7 +9,7 @@ CREATE TABLE user ( -- Needs to start with 0 - user_id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 0), + user_id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 0), user_name VARCHAR(255) NOT NULL UNIQUE, user_real_name VARCHAR(255), user_password VARCHAR(1024), @@ -220,8 +220,12 @@ CREATE TABLE categorylinks ( cl_to VARCHAR(255) NOT NULL, -- cl_sortkey has to be at least 86 wide -- in order to be compatible with the old MySQL schema from MW 1.10 - cl_sortkey VARCHAR(86), - cl_timestamp TIMESTAMP(3) NOT NULL + --cl_sortkey VARCHAR(86), + cl_sortkey VARCHAR(230) FOR BIT DATA NOT NULL , + cl_sortkey_prefix VARCHAR(255) FOR BIT DATA NOT NULL , + cl_timestamp TIMESTAMP(3) NOT NULL, + cl_collation VARCHAR(32) FOR BIT DATA NOT NULL , + cl_type VARCHAR(6) FOR BIT DATA NOT NULL ); CREATE UNIQUE INDEX cl_from ON categorylinks (cl_from, cl_to); CREATE INDEX cl_sortkey ON categorylinks (cl_to, cl_sortkey, cl_from); @@ -441,18 +445,11 @@ CREATE TABLE watchlist ( CREATE UNIQUE INDEX wl_user_namespace_title ON watchlist (wl_namespace, wl_title, wl_user); -CREATE TABLE math ( - math_inputhash VARCHAR(16) FOR BIT DATA NOT NULL UNIQUE, - math_outputhash VARCHAR(16) FOR BIT DATA NOT NULL, - math_html_conservativeness SMALLINT NOT NULL, - math_html CLOB(64K) INLINE LENGTH 4096, - math_mathml CLOB(64K) INLINE LENGTH 4096 -); - - CREATE TABLE interwiki ( iw_prefix VARCHAR(32) NOT NULL UNIQUE, iw_url CLOB(64K) INLINE LENGTH 4096 NOT NULL, + iw_api CLOB(64K) INLINE LENGTH 4096 NOT NULL, + iw_wikiid varchar(64) NOT NULL, iw_local SMALLINT NOT NULL, iw_trans SMALLINT NOT NULL DEFAULT 0 ); @@ -489,7 +486,7 @@ CREATE INDEX querycachetwo_titletwo ON querycachetwo (qcc_type,qcc_namespacetw CREATE TABLE objectcache ( keyname VARCHAR(255) NOT NULL UNIQUE, -- was nullable value CLOB(16M) INLINE LENGTH 4096 NOT NULL DEFAULT '', - exptime TIMESTAMP(3) NOT NULL + exptime TIMESTAMP(3) NOT NULL ); CREATE INDEX objectcacache_exptime ON objectcache (exptime); @@ -686,3 +683,58 @@ CREATE TABLE l10n_cache ( ); CREATE INDEX lc_lang_key ON l10n_cache (lc_lang, lc_key); + +CREATE TABLE "MSG_RESOURCE_LINKS" +( +"MRL_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL , +"MRL_MESSAGE" VARCHAR(255) FOR BIT DATA NOT NULL +) +; + +CREATE UNIQUE INDEX "UQ61_MSG_RESOURCE_LINKS" ON "MSG_RESOURCE_LINKS" +( +"MRL_MESSAGE", +"MRL_RESOURCE" +) +ALLOW REVERSE SCANS +; + +CREATE TABLE "MSG_RESOURCE" +( +"MR_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL , +"MR_LANG" VARCHAR(32) FOR BIT DATA NOT NULL , +"MR_BLOB" BLOB NOT NULL , +"MR_TIMESTAMP" TIMESTAMP(3) NOT NULL +) +; + +CREATE UNIQUE INDEX "UQ81_MSG_RESOURCE" ON "MSG_RESOURCE" +( +"MR_RESOURCE" +,"MR_LANG" +) +ALLOW REVERSE SCANS +; + +CREATE TABLE "MODULE_DEPS" ( +"MD_MODULE" VARCHAR(255) FOR BIT DATA NOT NULL , +"MD_SKIN" VARCHAR(32) FOR BIT DATA NOT NULL , +"MD_DEPS" CLOB(16M) INLINE LENGTH 4096 NOT NULL +) +; + +CREATE UNIQUE INDEX "UQ96_MODULE_DEPS" ON "MODULE_DEPS" +( +"MD_MODULE" +,"MD_SKIN" +) +ALLOW REVERSE SCANS +; + +CREATE TABLE "IWLINKS" +( +"IWL_FROM" INT NOT NULL , +"IWL_PREFIX" VARCHAR(20) FOR BIT DATA NOT NULL , +"IWL_TITLE" VARCHAR(255) FOR BIT DATA NOT NULL +) +; |