diff options
Diffstat (limited to 'maintenance/oracle')
10 files changed, 86 insertions, 25 deletions
diff --git a/maintenance/oracle/alterSharedConstraints.php b/maintenance/oracle/alterSharedConstraints.php index 435625d5..eea6f7b1 100644 --- a/maintenance/oracle/alterSharedConstraints.php +++ b/maintenance/oracle/alterSharedConstraints.php @@ -44,6 +44,7 @@ class AlterSharedConstraints extends Maintenance { if ( $wgSharedDB == null ) { $this->output( "Database sharing is not enabled\n" ); + return; } @@ -56,35 +57,38 @@ class AlterSharedConstraints extends Maintenance { $ltable = "{$wgDBprefix}{$stable}"; } - $result = $dbw->query( "SELECT uc.constraint_name, uc.table_name, ucc.column_name, uccpk.table_name pk_table_name, uccpk.column_name pk_column_name, uc.delete_rule, uc.deferrable, uc.deferred - FROM user_constraints uc, user_cons_columns ucc, user_cons_columns uccpk - WHERE uc.constraint_type = 'R' - AND ucc.constraint_name = uc.constraint_name - AND uccpk.constraint_name = uc.r_constraint_name - AND uccpk.table_name = '$ltable'" ); + $result = $dbw->query( "SELECT uc.constraint_name, uc.table_name, ucc.column_name, + uccpk.table_name pk_table_name, uccpk.column_name pk_column_name, + uc.delete_rule, uc.deferrable, uc.deferred + FROM user_constraints uc, user_cons_columns ucc, user_cons_columns uccpk + WHERE uc.constraint_type = 'R' + AND ucc.constraint_name = uc.constraint_name + AND uccpk.constraint_name = uc.r_constraint_name + AND uccpk.table_name = '$ltable'" ); while ( ( $row = $result->fetchRow() ) !== false ) { - $this->output( "Altering {$row['constraint_name']} ..." ); + $this->output( "Altering {$row['constraint_name']} ..." ); - try { - $dbw->query( "ALTER TABLE {$row['table_name']} DROP CONSTRAINT {$wgDBprefix}{$row['constraint_name']}" ); - } catch ( DBQueryError $exdb ) { - if ( $exdb->errno != 2443 ) { - throw $exdb; - } + try { + $dbw->query( "ALTER TABLE {$row['table_name']} + DROP CONSTRAINT {$wgDBprefix}{$row['constraint_name']}" ); + } catch ( DBQueryError $exdb ) { + if ( $exdb->errno != 2443 ) { + throw $exdb; } + } - $deleteRule = $row['delete_rule'] == 'NO ACTION' ? '' : "ON DELETE {$row['delete_rule']}"; - $dbw->query( "ALTER TABLE {$row['table_name']} ADD CONSTRAINT {$wgDBprefix}{$row['constraint_name']} + $deleteRule = $row['delete_rule'] == 'NO ACTION' ? '' : "ON DELETE {$row['delete_rule']}"; + $dbw->query( "ALTER TABLE {$row['table_name']} + ADD CONSTRAINT {$wgDBprefix}{$row['constraint_name']} FOREIGN KEY ({$row['column_name']}) REFERENCES {$wgSharedDB}.$stable({$row['pk_column_name']}) {$deleteRule} {$row['deferrable']} INITIALLY {$row['deferred']}" ); - $this->output( "DONE\n" ); + $this->output( "DONE\n" ); } } } - } $maintClass = "AlterSharedConstraints"; diff --git a/maintenance/oracle/archives/patch-logging_user_text_time_index.sql b/maintenance/oracle/archives/patch-logging_user_text_time_index.sql new file mode 100644 index 00000000..e04abf5f --- /dev/null +++ b/maintenance/oracle/archives/patch-logging_user_text_time_index.sql @@ -0,0 +1,4 @@ +define mw_prefix='{$wgDBprefix}'; + +CREATE INDEX &mw_prefix.logging_i07 ON &mw_prefix.logging (log_user_text, log_timestamp); + diff --git a/maintenance/oracle/archives/patch-logging_user_text_type_time_index.sql b/maintenance/oracle/archives/patch-logging_user_text_type_time_index.sql new file mode 100644 index 00000000..c1c0d4f2 --- /dev/null +++ b/maintenance/oracle/archives/patch-logging_user_text_type_time_index.sql @@ -0,0 +1,4 @@ +define mw_prefix='{$wgDBprefix}'; + +CREATE INDEX &mw_prefix.logging_i06 ON &mw_prefix.logging (log_user_text, log_type, log_timestamp); + diff --git a/maintenance/oracle/archives/patch-page-page_lang.sql b/maintenance/oracle/archives/patch-page-page_lang.sql new file mode 100644 index 00000000..cae7cf90 --- /dev/null +++ b/maintenance/oracle/archives/patch-page-page_lang.sql @@ -0,0 +1,3 @@ +define mw_prefix='{$wgDBprefix}'; + +ALTER TABLE &mw_prefix.page ADD page_lang VARCHAR2(35); diff --git a/maintenance/oracle/archives/patch-page_links_updated.sql b/maintenance/oracle/archives/patch-page_links_updated.sql new file mode 100644 index 00000000..53603294 --- /dev/null +++ b/maintenance/oracle/archives/patch-page_links_updated.sql @@ -0,0 +1,4 @@ +define mw_prefix='{$wgDBprefix}'; + +ALTER TABLE &mw_prefix.page ADD page_links_updated TIMESTAMP(6) WITH TIME ZONE; + diff --git a/maintenance/oracle/archives/patch-rc_source.sql b/maintenance/oracle/archives/patch-rc_source.sql new file mode 100644 index 00000000..0c80afab --- /dev/null +++ b/maintenance/oracle/archives/patch-rc_source.sql @@ -0,0 +1,3 @@ +define mw_prefix='{$wgDBprefix}'; + +ALTER TABLE &mw_prefix.recentchanges ADD rc_source VARCHAR2(16); diff --git a/maintenance/oracle/archives/patch-user_password_expire.sql b/maintenance/oracle/archives/patch-user_password_expire.sql new file mode 100644 index 00000000..824cc820 --- /dev/null +++ b/maintenance/oracle/archives/patch-user_password_expire.sql @@ -0,0 +1,3 @@ +define mw_prefix='{$wgDBprefix}'; + +ALTER TABLE &mw_prefix.mwuser ADD user_password_expires TIMESTAMP(6) WITH TIME ZONE; diff --git a/maintenance/oracle/archives/patch_16_17_schema_changes.sql b/maintenance/oracle/archives/patch_16_17_schema_changes.sql index 64c28481..cd99f7cc 100644 --- a/maintenance/oracle/archives/patch_16_17_schema_changes.sql +++ b/maintenance/oracle/archives/patch_16_17_schema_changes.sql @@ -67,7 +67,7 @@ CREATE TABLE &mw_prefix.msg_resource ( 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; diff --git a/maintenance/oracle/tables.sql b/maintenance/oracle/tables.sql index acfabc33..36be16e4 100644 --- a/maintenance/oracle/tables.sql +++ b/maintenance/oracle/tables.sql @@ -2,7 +2,7 @@ define mw_prefix='{$wgDBprefix}'; -CREATE SEQUENCE user_user_id_seq MINVALUE 0 START WITH 0; +CREATE SEQUENCE user_user_id_seq; CREATE TABLE &mw_prefix.mwuser ( -- replace reserved word 'user' user_id NUMBER NOT NULL, user_name VARCHAR2(255) NOT NULL, @@ -18,7 +18,8 @@ CREATE TABLE &mw_prefix.mwuser ( -- replace reserved word 'user' user_options CLOB, user_touched TIMESTAMP(6) WITH TIME ZONE, user_registration TIMESTAMP(6) WITH TIME ZONE, - user_editcount NUMBER + user_editcount NUMBER, + user_password_expires TIMESTAMP(6) WITH TIME ZONE ); ALTER TABLE &mw_prefix.mwuser ADD CONSTRAINT &mw_prefix.mwuser_pk PRIMARY KEY (user_id); CREATE UNIQUE INDEX &mw_prefix.mwuser_u01 ON &mw_prefix.mwuser (user_name); @@ -27,7 +28,8 @@ CREATE INDEX &mw_prefix.mwuser_i02 ON &mw_prefix.mwuser (user_email, user_name); -- Create a dummy user to satisfy fk contraints especially with revisions INSERT INTO &mw_prefix.mwuser - VALUES (user_user_id_seq.nextval,'Anonymous',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '', current_timestamp, current_timestamp, 0); + (user_id, user_name, user_options, user_touched, user_registration, user_editcount) + VALUES (0,'Anonymous','', current_timestamp, current_timestamp,0); CREATE TABLE &mw_prefix.user_groups ( ug_user NUMBER DEFAULT 0 NOT NULL, @@ -72,9 +74,11 @@ CREATE TABLE &mw_prefix.page ( page_is_new CHAR(1) DEFAULT '0' NOT NULL, page_random NUMBER(15,14) NOT NULL, page_touched TIMESTAMP(6) WITH TIME ZONE, + page_links_updated TIMESTAMP(6) WITH TIME ZONE, page_latest NUMBER DEFAULT 0 NOT NULL, -- FK? page_len NUMBER DEFAULT 0 NOT NULL, - page_content_model VARCHAR2(32) + page_content_model VARCHAR2(32), + page_lang VARCHAR2(35) DEFAULT NULL ); ALTER TABLE &mw_prefix.page ADD CONSTRAINT &mw_prefix.page_pk PRIMARY KEY (page_id); CREATE UNIQUE INDEX &mw_prefix.page_u01 ON &mw_prefix.page (page_namespace,page_title); @@ -84,7 +88,7 @@ CREATE INDEX &mw_prefix.page_i03 ON &mw_prefix.page (page_is_redirect, page_name -- Create a dummy page to satisfy fk contraints especially with revisions INSERT INTO &mw_prefix.page - VALUES (0, 0, ' ', NULL, 0, 0, 0, 0, current_timestamp, 0, 0, NULL); + VALUES (0, 0, ' ', NULL, 0, 0, 0, 0, current_timestamp, NULL, 0, 0, NULL, NULL); /*$mw$*/ CREATE TRIGGER &mw_prefix.page_set_random BEFORE INSERT ON &mw_prefix.page @@ -402,7 +406,7 @@ CREATE SEQUENCE recentchanges_rc_id_seq; CREATE TABLE &mw_prefix.recentchanges ( rc_id NUMBER NOT NULL, rc_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL, - rc_cur_time TIMESTAMP(6) WITH TIME ZONE NOT NULL, + rc_cur_time TIMESTAMP(6) WITH TIME ZONE, rc_user NUMBER DEFAULT 0 NOT NULL, rc_user_text VARCHAR2(255) NOT NULL, rc_namespace NUMBER DEFAULT 0 NOT NULL, @@ -415,6 +419,7 @@ CREATE TABLE &mw_prefix.recentchanges ( rc_this_oldid NUMBER DEFAULT 0 NOT NULL, rc_last_oldid NUMBER DEFAULT 0 NOT NULL, rc_type CHAR(1) DEFAULT '0' NOT NULL, + rc_source VARCHAR2(16), rc_patrolled CHAR(1) DEFAULT '0' NOT NULL, rc_ip VARCHAR2(15), rc_old_len NUMBER, @@ -509,6 +514,8 @@ CREATE INDEX &mw_prefix.logging_i02 ON &mw_prefix.logging (log_user, log_timesta CREATE INDEX &mw_prefix.logging_i03 ON &mw_prefix.logging (log_namespace, log_title, log_timestamp); CREATE INDEX &mw_prefix.logging_i04 ON &mw_prefix.logging (log_timestamp); CREATE INDEX &mw_prefix.logging_i05 ON &mw_prefix.logging (log_type, log_action, log_timestamp); +CREATE INDEX &mw_prefix.logging_i06 ON &mw_prefix.logging (log_user_text, log_type, log_timestamp); +CREATE INDEX &mw_prefix.logging_i07 ON &mw_prefix.logging (log_user_text, log_timestamp); CREATE TABLE &mw_prefix.log_search ( ls_field VARCHAR2(32) NOT NULL, @@ -663,7 +670,7 @@ CREATE TABLE &mw_prefix.msg_resource ( 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); CREATE TABLE &mw_prefix.msg_resource_links ( diff --git a/maintenance/oracle/update-keys.sql b/maintenance/oracle/update-keys.sql new file mode 100644 index 00000000..7761d0c5 --- /dev/null +++ b/maintenance/oracle/update-keys.sql @@ -0,0 +1,29 @@ +-- SQL to insert update keys into the initial tables after a +-- fresh installation of MediaWiki's database. +-- This is read and executed by the install script; you should +-- not have to run it by itself unless doing a manual install. +-- Insert keys here if either the unnecessary would cause heavy +-- processing or could potentially cause trouble by lowering field +-- sizes, adding constraints, etc. +-- When adjusting field sizes, it is recommended removing old +-- patches but to play safe, update keys should also inserted here. + +-- The /*_*/ comments in this and other files are +-- replaced with the defined table prefix by the installer +-- and updater scripts. If you are installing or running +-- updates manually, you will need to manually insert the +-- table prefix if any when running these scripts. +-- + +INSERT INTO /*_*/updatelog (ul_key, ul_value) + VALUES( 'filearchive-fa_major_mime-patch-fa_major_mime-chemical.sql', null ); +INSERT INTO /*_*/updatelog (ul_key, ul_value) + VALUES( 'image-img_major_mime-patch-img_major_mime-chemical.sql', null ); +INSERT INTO /*_*/updatelog (ul_key, ul_value) + VALUES( 'oldimage-oi_major_mime-patch-oi_major_mime-chemical.sql', null ); +INSERT INTO /*_*/updatelog (ul_key, ul_value) + VALUES( 'user_groups-ug_group-patch-ug_group-length-increase-255.sql', null ); +INSERT INTO /*_*/updatelog (ul_key, ul_value) + VALUES( 'user_former_groups-ufg_group-patch-ufg_group-length-increase-255.sql', null ); +INSERT INTO /*_*/updatelog (ul_key, ul_value) + VALUES( 'user_properties-up_property-patch-up_property.sql', null ); |