Index: trunk/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: trunk/phase3/maintenance/oracle/archives/patch_remove_not_null_empty_defs.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |
Index: trunk/phase3/maintenance/oracle/tables.sql |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | |
29 | 29 | -- Create a dummy user to satisfy fk contraints especially with revisions |
30 | 30 | INSERT INTO &mw_prefix.mwuser |
31 | | - VALUES (user_user_id_seq.nextval,'Anonymous','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '', current_timestamp, current_timestamp, 0); |
| 31 | + VALUES (user_user_id_seq.nextval,'Anonymous',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '', current_timestamp, current_timestamp, 0); |
32 | 32 | |
33 | 33 | CREATE TABLE &mw_prefix.user_groups ( |
34 | 34 | ug_user NUMBER DEFAULT 0 NOT NULL, |
— | — | @@ -169,9 +169,9 @@ |
170 | 170 | cl_from NUMBER NOT NULL, |
171 | 171 | cl_to VARCHAR2(255) NOT NULL, |
172 | 172 | cl_sortkey VARCHAR2(230), |
173 | | - cl_sortkey_prefix VARCHAR2(255) DEFAULT '' NOT NULL, |
| 173 | + cl_sortkey_prefix VARCHAR2(255), |
174 | 174 | cl_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL, |
175 | | - cl_collation VARCHAR2(32) DEFAULT '' NOT NULL, |
| 175 | + cl_collation VARCHAR2(32), |
176 | 176 | cl_type VARCHAR2(6) DEFAULT 'page' NOT NULL |
177 | 177 | ); |
178 | 178 | 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; |
— | — | @@ -221,8 +221,8 @@ |
222 | 222 | |
223 | 223 | CREATE TABLE &mw_prefix.iwlinks ( |
224 | 224 | iwl_from NUMBER DEFAULT 0 NOT NULL, |
225 | | - iwl_prefix VARCHAR2(20) DEFAULT '' NOT NULL, |
226 | | - iwl_title VARCHAR2(255) DEFAULT '' NOT NULL |
| 225 | + iwl_prefix VARCHAR2(20), |
| 226 | + iwl_title VARCHAR2(255) |
227 | 227 | ); |
228 | 228 | CREATE UNIQUE INDEX &mw_prefix.iwlinks_ui01 ON &mw_prefix.iwlinks (iwl_from, iwl_prefix, iwl_title); |
229 | 229 | CREATE UNIQUE INDEX &mw_prefix.iwlinks_ui02 ON &mw_prefix.iwlinks (iwl_prefix, iwl_title, iwl_from); |
— | — | @@ -408,7 +408,7 @@ |
409 | 409 | |
410 | 410 | CREATE TABLE &mw_prefix.searchindex ( |
411 | 411 | si_page NUMBER NOT NULL, |
412 | | - si_title VARCHAR2(255) DEFAULT '' NOT NULL, |
| 412 | + si_title VARCHAR2(255), |
413 | 413 | si_text CLOB NOT NULL |
414 | 414 | ); |
415 | 415 | CREATE UNIQUE INDEX &mw_prefix.searchindex_u01 ON &mw_prefix.searchindex (si_page); |
— | — | @@ -520,9 +520,9 @@ |
521 | 521 | qcc_type VARCHAR2(32) NOT NULL, |
522 | 522 | qcc_value NUMBER DEFAULT 0 NOT NULL, |
523 | 523 | qcc_namespace NUMBER DEFAULT 0 NOT NULL, |
524 | | - qcc_title VARCHAR2(255) DEFAULT '' NOT NULL, |
| 524 | + qcc_title VARCHAR2(255), |
525 | 525 | qcc_namespacetwo NUMBER DEFAULT 0 NOT NULL, |
526 | | - qcc_titletwo VARCHAR2(255) DEFAULT '' NOT NULL |
| 526 | + qcc_titletwo VARCHAR2(255) |
527 | 527 | ); |
528 | 528 | CREATE INDEX &mw_prefix.querycachetwo_i01 ON &mw_prefix.querycachetwo (qcc_type,qcc_value); |
529 | 529 | CREATE INDEX &mw_prefix.querycachetwo_i02 ON &mw_prefix.querycachetwo (qcc_type,qcc_namespace,qcc_title); |
Index: trunk/phase3/includes/installer/DatabaseUpdater.php |
— | — | @@ -232,6 +232,7 @@ |
233 | 233 | } |
234 | 234 | |
235 | 235 | protected function setAppliedUpdates( $version, $updates = array() ) { |
| 236 | + $this->db->clearFlag( DBO_DDLMODE ); |
236 | 237 | if( !$this->canUseNewUpdatelog() ) { |
237 | 238 | return; |
238 | 239 | } |
— | — | @@ -239,6 +240,7 @@ |
240 | 241 | $this->db->insert( 'updatelog', |
241 | 242 | array( 'ul_key' => $key, 'ul_value' => serialize( $updates ) ), |
242 | 243 | __METHOD__ ); |
| 244 | + $this->db->setFlag( DBO_DDLMODE ); |
243 | 245 | } |
244 | 246 | |
245 | 247 | /** |
— | — | @@ -265,11 +267,13 @@ |
266 | 268 | * @param $val String [optional] value to insert along with the key |
267 | 269 | */ |
268 | 270 | public function insertUpdateRow( $key, $val = null ) { |
| 271 | + $this->db->clearFlag( DBO_DDLMODE ); |
269 | 272 | $values = array( 'ul_key' => $key ); |
270 | 273 | if( $val && $this->canUseNewUpdatelog() ) { |
271 | 274 | $values['ul_value'] = $val; |
272 | 275 | } |
273 | 276 | $this->db->insert( 'updatelog', $values, __METHOD__, 'IGNORE' ); |
| 277 | + $this->db->setFlag( DBO_DDLMODE ); |
274 | 278 | } |
275 | 279 | |
276 | 280 | /** |
Index: trunk/phase3/includes/installer/OracleUpdater.php |
— | — | @@ -29,6 +29,7 @@ |
30 | 30 | array( 'doFunctions17' ), |
31 | 31 | array( 'doSchemaUpgrade17' ), |
32 | 32 | array( 'doInsertPage0' ), |
| 33 | + array( 'doRemoveNotNullEmptyDefaults' ), |
33 | 34 | |
34 | 35 | //1.18 |
35 | 36 | array( 'addIndex', 'user', 'i02', 'patch-user_email_index.sql' ), |
— | — | @@ -93,7 +94,7 @@ |
94 | 95 | protected function doSchemaUpgrade17() { |
95 | 96 | $this->output( "Updating schema to 17 ... " ); |
96 | 97 | // check if iwlinks table exists which was added in 1.17 |
97 | | - if ( $this->db->tableExists( $this->db->tableName( 'iwlinks' ) ) ) { |
| 98 | + if ( $this->db->tableExists( 'iwlinks' ) ) { |
98 | 99 | $this->output( "schema seem to be up to date.\n" ); |
99 | 100 | return; |
100 | 101 | } |
— | — | @@ -122,6 +123,20 @@ |
123 | 124 | $this->output( "ok\n" ); |
124 | 125 | } |
125 | 126 | |
| 127 | + /** |
| 128 | + * Remove DEFAULT '' NOT NULL constraints from fields as '' is internally |
| 129 | + * converted to NULL in Oracle |
| 130 | + */ |
| 131 | + protected function doRemoveNotNullEmptyDefaults() { |
| 132 | + $this->output( "Removing not null empty constraints ... " ); |
| 133 | + $meta = $this->db->fieldInfo( 'categorylinks' , 'cl_sortkey_prefix' ); |
| 134 | + if ( $meta->isNullable() ) { |
| 135 | + $this->output( "constraints seem to be removed\n" ); |
| 136 | + return; |
| 137 | + } |
| 138 | + $this->applyPatch( 'patch_remove_not_null_empty_defs.sql', false ); |
| 139 | + $this->output( "ok\n" ); |
| 140 | + } |
126 | 141 | |
127 | 142 | /** |
128 | 143 | * rebuilding of the function that duplicates tables for tests |