Index: branches/REL1_17/phase3/maintenance/oracle/archives/patch_remove_not_null_empty_defs.sql |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +define mw_prefix='{$wgDBprefix}'; |
| 3 | + |
| 4 | +ALTER TABLE &mw_prefix.categorylinks MODIFY cl_sortkey_prefix DEFAULT NULL NULL; |
| 5 | +ALTER TABLE &mw_prefix.categorylinks MODIFY cl_collation DEFAULT NULL NULL; |
| 6 | +ALTER TABLE &mw_prefix.iwlinks MODIFY iwl_prefix DEFAULT NULL NULL; |
| 7 | +ALTER TABLE &mw_prefix.iwlinks MODIFY iwl_title DEFAULT NULL NULL; |
| 8 | +ALTER TABLE &mw_prefix.searchindex MODIFY si_title DEFAULT NULL NULL; |
| 9 | +ALTER TABLE &mw_prefix.querycachetwo MODIFY qcc_title DEFAULT NULL NULL; |
| 10 | +ALTER TABLE &mw_prefix.querycachetwo MODIFY qcc_titletwo DEFAULT NULL NULL; |
Property changes on: branches/REL1_17/phase3/maintenance/oracle/archives/patch_remove_not_null_empty_defs.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |
Index: branches/REL1_17/phase3/maintenance/oracle/tables.sql |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | |
28 | 28 | -- Create a dummy user to satisfy fk contraints especially with revisions |
29 | 29 | INSERT INTO &mw_prefix.mwuser |
30 | | - VALUES (user_user_id_seq.nextval,'Anonymous','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '', current_timestamp, current_timestamp, 0); |
| 30 | + VALUES (user_user_id_seq.nextval,'Anonymous',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '', current_timestamp, current_timestamp, 0); |
31 | 31 | |
32 | 32 | CREATE TABLE &mw_prefix.user_groups ( |
33 | 33 | ug_user NUMBER DEFAULT 0 NOT NULL, |
— | — | @@ -168,9 +168,9 @@ |
169 | 169 | cl_from NUMBER NOT NULL, |
170 | 170 | cl_to VARCHAR2(255) NOT NULL, |
171 | 171 | cl_sortkey VARCHAR2(230), |
172 | | - cl_sortkey_prefix VARCHAR2(255) DEFAULT '' NOT NULL, |
| 172 | + cl_sortkey_prefix VARCHAR2(255), |
173 | 173 | cl_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL, |
174 | | - cl_collation VARCHAR2(32) DEFAULT '' NOT NULL, |
| 174 | + cl_collation VARCHAR2(32), |
175 | 175 | cl_type VARCHAR2(6) DEFAULT 'page' NOT NULL |
176 | 176 | ); |
177 | 177 | 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; |
— | — | @@ -220,8 +220,8 @@ |
221 | 221 | |
222 | 222 | CREATE TABLE &mw_prefix.iwlinks ( |
223 | 223 | iwl_from NUMBER DEFAULT 0 NOT NULL, |
224 | | - iwl_prefix VARCHAR2(20) DEFAULT '' NOT NULL, |
225 | | - iwl_title VARCHAR2(255) DEFAULT '' NOT NULL |
| 224 | + iwl_prefix VARCHAR2(20), |
| 225 | + iwl_title VARCHAR2(255) |
226 | 226 | ); |
227 | 227 | CREATE UNIQUE INDEX &mw_prefix.iwlinks_ui01 ON &mw_prefix.iwlinks (iwl_from, iwl_prefix, iwl_title); |
228 | 228 | CREATE UNIQUE INDEX &mw_prefix.iwlinks_ui02 ON &mw_prefix.iwlinks (iwl_prefix, iwl_title, iwl_from); |
— | — | @@ -416,7 +416,7 @@ |
417 | 417 | |
418 | 418 | CREATE TABLE &mw_prefix.searchindex ( |
419 | 419 | si_page NUMBER NOT NULL, |
420 | | - si_title VARCHAR2(255) DEFAULT '' NOT NULL, |
| 420 | + si_title VARCHAR2(255), |
421 | 421 | si_text CLOB NOT NULL |
422 | 422 | ); |
423 | 423 | CREATE UNIQUE INDEX &mw_prefix.searchindex_u01 ON &mw_prefix.searchindex (si_page); |
— | — | @@ -528,9 +528,9 @@ |
529 | 529 | qcc_type VARCHAR2(32) NOT NULL, |
530 | 530 | qcc_value NUMBER DEFAULT 0 NOT NULL, |
531 | 531 | qcc_namespace NUMBER DEFAULT 0 NOT NULL, |
532 | | - qcc_title VARCHAR2(255) DEFAULT '' NOT NULL, |
| 532 | + qcc_title VARCHAR2(255), |
533 | 533 | qcc_namespacetwo NUMBER DEFAULT 0 NOT NULL, |
534 | | - qcc_titletwo VARCHAR2(255) DEFAULT '' NOT NULL |
| 534 | + qcc_titletwo VARCHAR2(255) |
535 | 535 | ); |
536 | 536 | CREATE INDEX &mw_prefix.querycachetwo_i01 ON &mw_prefix.querycachetwo (qcc_type,qcc_value); |
537 | 537 | CREATE INDEX &mw_prefix.querycachetwo_i02 ON &mw_prefix.querycachetwo (qcc_type,qcc_namespace,qcc_title); |
Index: branches/REL1_17/phase3/includes/installer/OracleUpdater.php |
— | — | @@ -21,6 +21,7 @@ |
22 | 22 | array( 'doFunctions17' ), |
23 | 23 | array( 'doSchemaUpgrade17' ), |
24 | 24 | array( 'doInsertPage0' ), |
| 25 | + array( 'doRemoveNotNullEmptyDefaults' ), |
25 | 26 | ); |
26 | 27 | } |
27 | 28 | |
— | — | @@ -103,6 +104,21 @@ |
104 | 105 | } |
105 | 106 | |
106 | 107 | /** |
| 108 | + * Remove DEFAULT '' NOT NULL constraints from fields as '' is internally |
| 109 | + * converted to NULL in Oracle |
| 110 | + */ |
| 111 | + protected function doRemoveNotNullEmptyDefaults() { |
| 112 | + $this->output( "Removing not null empty constraints ... " ); |
| 113 | + $meta = $this->db->fieldInfo( 'categorylinks' , 'cl_sortkey_prefix' ); |
| 114 | + if ( $meta->isNullable() ) { |
| 115 | + $this->output( "constraints seem to be removed\n" ); |
| 116 | + return; |
| 117 | + } |
| 118 | + $this->applyPatch( 'patch_remove_not_null_empty_defs.sql', false ); |
| 119 | + $this->output( "ok\n" ); |
| 120 | + } |
| 121 | + |
| 122 | + /** |
107 | 123 | * Overload: after this action field info table has to be rebuilt |
108 | 124 | */ |
109 | 125 | public function doUpdates( $what = array( 'core', 'extensions', 'purge' ) ) { |