summaryrefslogtreecommitdiff
path: root/maintenance/oracle/archives
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/oracle/archives')
-rw-r--r--maintenance/oracle/archives/patch-testrun.sql37
-rw-r--r--maintenance/oracle/archives/patch_16_17_schema_changes.sql98
-rw-r--r--maintenance/oracle/archives/patch_create_17_functions.sql125
-rw-r--r--maintenance/oracle/archives/patch_fk_rename_deferred.sql41
-rw-r--r--maintenance/oracle/archives/patch_namespace_defaults.sql17
5 files changed, 318 insertions, 0 deletions
diff --git a/maintenance/oracle/archives/patch-testrun.sql b/maintenance/oracle/archives/patch-testrun.sql
new file mode 100644
index 00000000..6e3e1b7c
--- /dev/null
+++ b/maintenance/oracle/archives/patch-testrun.sql
@@ -0,0 +1,37 @@
+--
+-- Optional tables for parserTests recording mode
+-- With --record option, success data will be saved to these tables,
+-- and comparisons of what's changed from the previous run will be
+-- displayed at the end of each run.
+--
+-- defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}';
+define mw_prefix='{$wgDBprefix}';
+
+DROP TABLE &mw_prefix.testitem CASCADE CONSTRAINTS;
+DROP TABLE &mw_prefix.testrun CASCADE CONSTRAINTS;
+
+CREATE SEQUENCE testrun_tr_id_seq;
+CREATE TABLE &mw_prefix.testrun (
+ tr_id NUMBER NOT NULL,
+ tr_date DATE,
+ tr_mw_version BLOB,
+ tr_php_version BLOB,
+ tr_db_version BLOB,
+ tr_uname BLOB,
+);
+ALTER TABLE &mw_prefix.testrun ADD CONSTRAINT &mw_prefix.testrun_pk PRIMARY KEY (tr_id);
+CREATE OR REPLACE TRIGGER &mw_prefix.testrun_bir
+BEFORE UPDATE FOR EACH ROW
+ON &mw_prefix.testrun
+BEGIN
+ SELECT testrun_tr_id_seq.NEXTVAL into :NEW.tr_id FROM dual;
+END;
+
+CREATE TABLE /*$wgDBprefix*/testitem (
+ ti_run NUMBER NOT NULL REFERENCES &mw_prefix.testrun (tr_id) ON DELETE CASCADE,
+ ti_name VARCHAR22(255),
+ ti_success NUMBER(1)
+);
+CREATE UNIQUE INDEX &mw_prefix.testitem_u01 ON &mw_prefix.testitem (ti_run, ti_name);
+CREATE UNIQUE INDEX &mw_prefix.testitem_u01 ON &mw_prefix.testitem (ti_run, ti_success);
+
diff --git a/maintenance/oracle/archives/patch_16_17_schema_changes.sql b/maintenance/oracle/archives/patch_16_17_schema_changes.sql
new file mode 100644
index 00000000..64c28481
--- /dev/null
+++ b/maintenance/oracle/archives/patch_16_17_schema_changes.sql
@@ -0,0 +1,98 @@
+define mw_prefix='{$wgDBprefix}';
+
+ALTER TABLE &mw_prefix.archive MODIFY ar_user DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.archive MODIFY ar_deleted CHAR(1);
+CREATE INDEX &mw_prefix.archive_i03 ON &mw_prefix.archive (ar_rev_id);
+
+ALTER TABLE &mw_prefix.page MODIFY page_is_redirect default '0';
+ALTER TABLE &mw_prefix.page MODIFY page_is_new default '0';
+ALTER TABLE &mw_prefix.page MODIFY page_latest default 0;
+ALTER TABLE &mw_prefix.page MODIFY page_len default 0;
+
+ALTER TABLE &mw_prefix.categorylinks MODIFY cl_sortkey VARCHAR2(230);
+ALTER TABLE &mw_prefix.categorylinks ADD cl_sortkey_prefix VARCHAR2(255) DEFAULT '' NOT NULL;
+ALTER TABLE &mw_prefix.categorylinks ADD cl_collation VARCHAR2(32) DEFAULT '' NOT NULL;
+ALTER TABLE &mw_prefix.categorylinks ADD cl_type VARCHAR2(6) DEFAULT 'page' NOT NULL;
+DROP INDEX &mw_prefix.categorylinks_i01;
+CREATE INDEX &mw_prefix.categorylinks_i01 ON &mw_prefix.categorylinks (cl_to,cl_type,cl_sortkey,cl_from);
+CREATE INDEX &mw_prefix.categorylinks_i03 ON &mw_prefix.categorylinks (cl_collation);
+
+ALTER TABLE &mw_prefix.filearchive MODIFY fa_deleted_user DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.filearchive MODIFY fa_size DEFAULT 0;
+ALTER TABLE &mw_prefix.filearchive MODIFY fa_width DEFAULT 0;
+ALTER TABLE &mw_prefix.filearchive MODIFY fa_height DEFAULT 0;
+ALTER TABLE &mw_prefix.filearchive MODIFY fa_bits DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.filearchive MODIFY fa_user DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.filearchive MODIFY fa_deleted DEFAULT 0;
+
+ALTER TABLE &mw_prefix.image MODIFY img_size DEFAULT 0;
+ALTER TABLE &mw_prefix.image MODIFY img_width DEFAULT 0;
+ALTER TABLE &mw_prefix.image MODIFY img_height DEFAULT 0;
+ALTER TABLE &mw_prefix.image MODIFY img_bits DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.image MODIFY img_user DEFAULT 0 NOT NULL;
+
+ALTER TABLE &mw_prefix.interwiki ADD iw_api BLOB DEFAULT EMPTY_BLOB();
+ALTER TABLE &mw_prefix.interwiki MODIFY iw_api DEFAULT NULL NOT NULL;
+ALTER TABLE &mw_prefix.interwiki ADD iw_wikiid VARCHAR2(64);
+
+ALTER TABLE &mw_prefix.ipblocks MODIFY ipb_user DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.ipblocks MODIFY ipb_by DEFAULT 0;
+
+CREATE TABLE &mw_prefix.iwlinks (
+ iwl_from NUMBER DEFAULT 0 NOT NULL,
+ iwl_prefix VARCHAR2(20) DEFAULT '' NOT NULL,
+ iwl_title VARCHAR2(255) DEFAULT '' NOT NULL
+);
+CREATE UNIQUE INDEX &mw_prefix.iwlinks_ui01 ON &mw_prefix.iwlinks (iwl_from, iwl_prefix, iwl_title);
+CREATE UNIQUE INDEX &mw_prefix.iwlinks_ui02 ON &mw_prefix.iwlinks (iwl_prefix, iwl_title, iwl_from);
+
+ALTER TABLE &mw_prefix.logging MODIFY log_user DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.logging MODIFY log_deleted CHAR(1);
+
+CREATE TABLE &mw_prefix.module_deps (
+ md_module VARCHAR2(255) NOT NULL,
+ md_skin VARCHAR2(32) NOT NULL,
+ md_deps BLOB NOT NULL
+);
+CREATE UNIQUE INDEX &mw_prefix.module_deps_u01 ON &mw_prefix.module_deps (md_module, md_skin);
+
+CREATE TABLE &mw_prefix.msg_resource_links (
+ mrl_resource VARCHAR2(255) NOT NULL,
+ mrl_message VARCHAR2(255) NOT NULL
+);
+CREATE UNIQUE INDEX &mw_prefix.msg_resource_links_u01 ON &mw_prefix.msg_resource_links (mrl_message, mrl_resource);
+
+CREATE TABLE &mw_prefix.msg_resource (
+ mr_resource VARCHAR2(255) NOT NULL,
+ mr_lang varchar2(32) NOT NULL,
+ mr_blob BLOB NOT NULL,
+ mr_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL
+) ;
+CREATE UNIQUE INDEX &mw_prefix.msg_resource_u01 ON &mw_prefix.msg_resource (mr_resource, mr_lang);
+
+ALTER TABLE &mw_prefix.oldimage MODIFY oi_name DEFAULT 0;
+ALTER TABLE &mw_prefix.oldimage MODIFY oi_size DEFAULT 0;
+ALTER TABLE &mw_prefix.oldimage MODIFY oi_width DEFAULT 0;
+ALTER TABLE &mw_prefix.oldimage MODIFY oi_height DEFAULT 0;
+ALTER TABLE &mw_prefix.oldimage MODIFY oi_bits DEFAULT 0;
+ALTER TABLE &mw_prefix.oldimage MODIFY oi_user DEFAULT 0 NOT NULL;
+
+ALTER TABLE &mw_prefix.querycache MODIFY qc_value DEFAULT 0;
+
+ALTER TABLE &mw_prefix.recentchanges MODIFY rc_user DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.recentchanges MODIFY rc_cur_id DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.recentchanges MODIFY rc_this_oldid DEFAULT 0;
+ALTER TABLE &mw_prefix.recentchanges MODIFY rc_last_oldid DEFAULT 0;
+ALTER TABLE &mw_prefix.recentchanges MODIFY rc_moved_to_ns DEFAULT 0 NOT NULL;
+ALTER TABLE &mw_prefix.recentchanges MODIFY rc_deleted CHAR(1);
+ALTER TABLE &mw_prefix.recentchanges MODIFY rc_logid DEFAULT 0;
+
+ALTER TABLE &mw_prefix.revision MODIFY rev_page NOT NULL;
+ALTER TABLE &mw_prefix.revision MODIFY rev_user DEFAULT 0;
+
+ALTER TABLE &mw_prefix.updatelog ADD ul_value BLOB;
+
+ALTER TABLE &mw_prefix.user_groups MODIFY ug_user DEFAULT 0 NOT NULL;
+
+ALTER TABLE &mw_prefix.user_newtalk MODIFY user_id DEFAULT 0;
+
diff --git a/maintenance/oracle/archives/patch_create_17_functions.sql b/maintenance/oracle/archives/patch_create_17_functions.sql
new file mode 100644
index 00000000..6c9c9542
--- /dev/null
+++ b/maintenance/oracle/archives/patch_create_17_functions.sql
@@ -0,0 +1,125 @@
+define mw_prefix='{$wgDBprefix}';
+
+/*$mw$*/
+CREATE OR REPLACE PROCEDURE duplicate_table(p_tabname IN VARCHAR2,
+ p_oldprefix IN VARCHAR2,
+ p_newprefix IN VARCHAR2,
+ p_temporary IN BOOLEAN) IS
+ e_table_not_exist EXCEPTION;
+ PRAGMA EXCEPTION_INIT(e_table_not_exist, -00942);
+ l_temp_ei_sql VARCHAR2(2000);
+BEGIN
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ' || p_newprefix || p_tabname ||
+ ' CASCADE CONSTRAINTS';
+ EXCEPTION
+ WHEN e_table_not_exist THEN
+ NULL;
+ END;
+ IF (p_temporary) THEN
+ EXECUTE IMMEDIATE 'CREATE GLOBAL TEMPORARY TABLE ' || p_newprefix ||
+ p_tabname || ' AS SELECT * FROM ' || p_oldprefix ||
+ p_tabname || ' WHERE ROWNUM = 0';
+ ELSE
+ EXECUTE IMMEDIATE 'CREATE TABLE ' || p_newprefix || p_tabname ||
+ ' AS SELECT * FROM ' || p_oldprefix || p_tabname ||
+ ' WHERE ROWNUM = 0';
+ END IF;
+ FOR rc IN (SELECT column_name, data_default
+ FROM user_tab_columns
+ WHERE table_name = p_oldprefix || p_tabname
+ AND data_default IS NOT NULL) LOOP
+ EXECUTE IMMEDIATE 'ALTER TABLE ' || p_newprefix || p_tabname ||
+ ' MODIFY ' || rc.column_name || ' DEFAULT ' ||
+ SUBSTR(rc.data_default, 1, 2000);
+ END LOOP;
+ FOR rc IN (SELECT REPLACE(REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('CONSTRAINT',
+ constraint_name),
+ 32767,
+ 1),
+ USER || '"."' || p_oldprefix,
+ USER || '"."' || p_newprefix),
+ '"' || constraint_name || '"',
+ '"' || p_newprefix || constraint_name || '"') DDLVC2,
+ constraint_name
+ FROM user_constraints uc
+ WHERE table_name = p_oldprefix || p_tabname
+ AND constraint_type = 'P') LOOP
+ l_temp_ei_sql := SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1);
+ l_temp_ei_sql := SUBSTR(l_temp_ei_sql, 1, INSTR(l_temp_ei_sql, ')', INSTR(l_temp_ei_sql, 'PRIMARY KEY')+1)+1);
+ EXECUTE IMMEDIATE l_temp_ei_sql;
+ END LOOP;
+ IF (NOT p_temporary) THEN
+ FOR rc IN (SELECT REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('REF_CONSTRAINT',
+ constraint_name),
+ 32767,
+ 1),
+ USER || '"."' || p_oldprefix,
+ USER || '"."' || p_newprefix) DDLVC2,
+ constraint_name
+ FROM user_constraints uc
+ WHERE table_name = p_oldprefix || p_tabname
+ AND constraint_type = 'R') LOOP
+ EXECUTE IMMEDIATE rc.ddlvc2;
+ END LOOP;
+ END IF;
+ FOR rc IN (SELECT REPLACE(REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('INDEX',
+ index_name),
+ 32767,
+ 1),
+ USER || '"."' || p_oldprefix,
+ USER || '"."' || p_newprefix),
+ '"' || index_name || '"',
+ '"' || p_newprefix || index_name || '"') DDLVC2,
+ index_name,
+ index_type
+ FROM user_indexes ui
+ WHERE table_name = p_oldprefix || p_tabname
+ AND index_type NOT IN ('LOB', 'DOMAIN')
+ AND NOT EXISTS
+ (SELECT NULL
+ FROM user_constraints
+ WHERE table_name = ui.table_name
+ AND constraint_name = ui.index_name)) LOOP
+ l_temp_ei_sql := SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1);
+ l_temp_ei_sql := SUBSTR(l_temp_ei_sql, 1, INSTR(l_temp_ei_sql, ')', INSTR(l_temp_ei_sql, '"' || USER || '"."' || p_newprefix || '"')+1)+1);
+ EXECUTE IMMEDIATE l_temp_ei_sql;
+ END LOOP;
+ FOR rc IN (SELECT REPLACE(REPLACE(UPPER(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('TRIGGER',
+ trigger_name),
+ 32767,
+ 1)),
+ USER || '"."' || p_oldprefix,
+ USER || '"."' || p_newprefix),
+ ' ON ' || p_oldprefix || p_tabname,
+ ' ON ' || p_newprefix || p_tabname) DDLVC2,
+ trigger_name
+ FROM user_triggers
+ WHERE table_name = p_oldprefix || p_tabname) LOOP
+ l_temp_ei_sql := SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'ALTER ') - 1);
+ dbms_output.put_line(l_temp_ei_sql);
+ EXECUTE IMMEDIATE l_temp_ei_sql;
+ END LOOP;
+END;
+/*$mw$*/
+
+CREATE OR REPLACE TYPE GET_OUTPUT_TYPE IS TABLE OF VARCHAR2(255);
+
+/*$mw$*/
+CREATE OR REPLACE FUNCTION GET_OUTPUT_LINES RETURN GET_OUTPUT_TYPE PIPELINED AS
+ v_line VARCHAR2(255);
+ v_status INTEGER := 0;
+BEGIN
+
+ LOOP
+ DBMS_OUTPUT.GET_LINE(v_line, v_status);
+ IF (v_status = 0) THEN RETURN; END IF;
+ PIPE ROW (v_line);
+ END LOOP;
+ RETURN;
+EXCEPTION
+ WHEN OTHERS THEN
+ RETURN;
+END;
+/*$mw$*/
+
diff --git a/maintenance/oracle/archives/patch_fk_rename_deferred.sql b/maintenance/oracle/archives/patch_fk_rename_deferred.sql
new file mode 100644
index 00000000..ce5be9af
--- /dev/null
+++ b/maintenance/oracle/archives/patch_fk_rename_deferred.sql
@@ -0,0 +1,41 @@
+define mw_prefix='{$wgDBprefix}';
+
+/*$mw$*/
+BEGIN
+-- drop all, recreate manual in case anyone was missing
+ FOR cc1 IN (SELECT uc.table_name,
+ uc.constraint_name
+ FROM user_constraints uc
+ WHERE uc.constraint_type = 'R') LOOP
+ EXECUTE IMMEDIATE 'ALTER TABLE &mw_prefix.' || cc1.table_name ||
+ ' DROP CONSTRAINT ' || cc1.constraint_name;
+ END LOOP;
+END;
+/*$mw$*/
+
+ALTER TABLE &mw_prefix.user_groups ADD CONSTRAINT &mw_prefix.user_groups_fk1 FOREIGN KEY (ug_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.user_newtalk ADD CONSTRAINT &mw_prefix.user_newtalk_fk1 FOREIGN KEY (user_id) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.revision ADD CONSTRAINT &mw_prefix.revision_fk1 FOREIGN KEY (rev_page) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.revision ADD CONSTRAINT &mw_prefix.revision_fk2 FOREIGN KEY (rev_user) REFERENCES &mw_prefix.mwuser(user_id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.archive ADD CONSTRAINT &mw_prefix.archive_fk1 FOREIGN KEY (ar_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.pagelinks ADD CONSTRAINT &mw_prefix.pagelinks_fk1 FOREIGN KEY (pl_from) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.templatelinks ADD CONSTRAINT &mw_prefix.templatelinks_fk1 FOREIGN KEY (tl_from) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.imagelinks ADD CONSTRAINT &mw_prefix.imagelinks_fk1 FOREIGN KEY (il_from) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.categorylinks ADD CONSTRAINT &mw_prefix.categorylinks_fk1 FOREIGN KEY (cl_from) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.externallinks ADD CONSTRAINT &mw_prefix.externallinks_fk1 FOREIGN KEY (el_from) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.langlinks ADD CONSTRAINT &mw_prefix.langlinks_fk1 FOREIGN KEY (ll_from) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.ipblocks ADD CONSTRAINT &mw_prefix.ipblocks_fk1 FOREIGN KEY (ipb_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.ipblocks ADD CONSTRAINT &mw_prefix.ipblocks_fk2 FOREIGN KEY (ipb_by) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.image ADD CONSTRAINT &mw_prefix.image_fk1 FOREIGN KEY (img_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.oldimage ADD CONSTRAINT &mw_prefix.oldimage_fk1 FOREIGN KEY (oi_name) REFERENCES &mw_prefix.image(img_name) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.oldimage ADD CONSTRAINT &mw_prefix.oldimage_fk2 FOREIGN KEY (oi_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.filearchive ADD CONSTRAINT &mw_prefix.filearchive_fk1 FOREIGN KEY (fa_deleted_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.filearchive ADD CONSTRAINT &mw_prefix.filearchive_fk2 FOREIGN KEY (fa_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.recentchanges ADD CONSTRAINT &mw_prefix.recentchanges_fk1 FOREIGN KEY (rc_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.recentchanges ADD CONSTRAINT &mw_prefix.recentchanges_fk2 FOREIGN KEY (rc_cur_id) REFERENCES &mw_prefix.page(page_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.watchlist ADD CONSTRAINT &mw_prefix.watchlist_fk1 FOREIGN KEY (wl_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.logging ADD CONSTRAINT &mw_prefix.logging_fk1 FOREIGN KEY (log_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.trackbacks ADD CONSTRAINT &mw_prefix.trackbacks_fk1 FOREIGN KEY (tb_page) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.redirect ADD CONSTRAINT &mw_prefix.redirect_fk1 FOREIGN KEY (rd_from) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE &mw_prefix.page_restrictions ADD CONSTRAINT &mw_prefix.page_restrictions_fk1 FOREIGN KEY (pr_page) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+
diff --git a/maintenance/oracle/archives/patch_namespace_defaults.sql b/maintenance/oracle/archives/patch_namespace_defaults.sql
new file mode 100644
index 00000000..24c95643
--- /dev/null
+++ b/maintenance/oracle/archives/patch_namespace_defaults.sql
@@ -0,0 +1,17 @@
+define mw_prefix='{$wgDBprefix}';
+
+ALTER TABLE &mw_prefix.page MODIFY page_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.pagelinks MODIFY pl_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.templatelinks MODIFY tl_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.recentchanges MODIFY rc_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.querycache MODIFY qc_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.logging MODIFY log_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.job MODIFY job_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.redirect MODIFY rd_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.protected_titles MODIFY pt_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0;
+ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0;
+