Index: trunk/phase3/maintenance/oracle/archives/patch_namespace_defaults.sql |
— | — | @@ -0,0 +1,17 @@ |
| 2 | +define mw_prefix='{$wgDBprefix}'; |
| 3 | + |
| 4 | +ALTER TABLE &mw_prefix.page MODIFY page_namespace DEFAULT 0; |
| 5 | +ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0; |
| 6 | +ALTER TABLE &mw_prefix.pagelinks MODIFY pl_namespace DEFAULT 0; |
| 7 | +ALTER TABLE &mw_prefix.templatelinks MODIFY tl_namespace DEFAULT 0; |
| 8 | +ALTER TABLE &mw_prefix.recentchanges MODIFY rc_namespace DEFAULT 0; |
| 9 | +ALTER TABLE &mw_prefix.querycache MODIFY qc_namespace DEFAULT 0; |
| 10 | +ALTER TABLE &mw_prefix.logging MODIFY log_namespace DEFAULT 0; |
| 11 | +ALTER TABLE &mw_prefix.job MODIFY job_namespace DEFAULT 0; |
| 12 | +ALTER TABLE &mw_prefix.redirect MODIFY rd_namespace DEFAULT 0; |
| 13 | +ALTER TABLE &mw_prefix.protected_titles MODIFY pt_namespace DEFAULT 0; |
| 14 | +ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0; |
| 15 | +ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0; |
| 16 | +ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0; |
| 17 | +ALTER TABLE &mw_prefix.archive MODIFY ar_namespace DEFAULT 0; |
| 18 | + |
Property changes on: trunk/phase3/maintenance/oracle/archives/patch_namespace_defaults.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 19 | + native |
Index: trunk/phase3/maintenance/oracle/tables.sql |
— | — | @@ -29,14 +29,14 @@ |
30 | 30 | VALUES (user_user_id_seq.nextval,'Anonymous','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '', current_timestamp, current_timestamp, 0); |
31 | 31 | |
32 | 32 | CREATE TABLE &mw_prefix.user_groups ( |
33 | | - ug_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE, |
| 33 | + ug_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
34 | 34 | ug_group VARCHAR2(16) NOT NULL |
35 | 35 | ); |
36 | 36 | CREATE UNIQUE INDEX &mw_prefix.user_groups_u01 ON &mw_prefix.user_groups (ug_user,ug_group); |
37 | 37 | CREATE INDEX &mw_prefix.user_groups_i01 ON &mw_prefix.user_groups (ug_group); |
38 | 38 | |
39 | 39 | CREATE TABLE &mw_prefix.user_newtalk ( |
40 | | - user_id NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE, |
| 40 | + user_id NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
41 | 41 | user_ip VARCHAR2(40) NULL, |
42 | 42 | user_last_timestamp TIMESTAMP(6) WITH TIME ZONE |
43 | 43 | ); |
— | — | @@ -51,20 +51,19 @@ |
52 | 52 | CREATE UNIQUE INDEX &mw_prefix.user_properties_u01 on &mw_prefix.user_properties (up_user,up_property); |
53 | 53 | CREATE INDEX &mw_prefix.user_properties_i01 on &mw_prefix.user_properties (up_property); |
54 | 54 | |
55 | | - |
56 | 55 | CREATE SEQUENCE page_page_id_seq; |
57 | 56 | CREATE TABLE &mw_prefix.page ( |
58 | 57 | page_id NUMBER NOT NULL, |
59 | | - page_namespace NUMBER NOT NULL, |
| 58 | + page_namespace NUMBER DEFAULT 0 NOT NULL, |
60 | 59 | page_title VARCHAR2(255) NOT NULL, |
61 | 60 | page_restrictions VARCHAR2(255), |
62 | 61 | page_counter NUMBER DEFAULT 0 NOT NULL, |
63 | | - page_is_redirect CHAR(1) DEFAULT 0 NOT NULL, |
64 | | - page_is_new CHAR(1) DEFAULT 0 NOT NULL, |
| 62 | + page_is_redirect CHAR(1) DEFAULT '0' NOT NULL, |
| 63 | + page_is_new CHAR(1) DEFAULT '0' NOT NULL, |
65 | 64 | page_random NUMBER(15,14) NOT NULL, |
66 | 65 | page_touched TIMESTAMP(6) WITH TIME ZONE, |
67 | | - page_latest NUMBER NOT NULL, -- FK? |
68 | | - page_len NUMBER NOT NULL |
| 66 | + page_latest NUMBER DEFAULT 0 NOT NULL, -- FK? |
| 67 | + page_len NUMBER DEFAULT 0 NOT NULL |
69 | 68 | ); |
70 | 69 | ALTER TABLE &mw_prefix.page ADD CONSTRAINT &mw_prefix.page_pk PRIMARY KEY (page_id); |
71 | 70 | CREATE UNIQUE INDEX &mw_prefix.page_u01 ON &mw_prefix.page (page_namespace,page_title); |
— | — | @@ -82,10 +81,10 @@ |
83 | 82 | CREATE SEQUENCE revision_rev_id_seq; |
84 | 83 | CREATE TABLE &mw_prefix.revision ( |
85 | 84 | rev_id NUMBER NOT NULL, |
86 | | - rev_page NUMBER NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE, |
| 85 | + rev_page NUMBER NOT NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
87 | 86 | rev_text_id NUMBER NULL, |
88 | 87 | rev_comment VARCHAR2(255), |
89 | | - rev_user NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id), |
| 88 | + rev_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) DEFERRABLE INITIALLY DEFERRED, |
90 | 89 | rev_user_text VARCHAR2(255) NOT NULL, |
91 | 90 | rev_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL, |
92 | 91 | rev_minor_edit CHAR(1) DEFAULT '0' NOT NULL, |
— | — | @@ -109,18 +108,18 @@ |
110 | 109 | ALTER TABLE &mw_prefix.pagecontent ADD CONSTRAINT &mw_prefix.pagecontent_pk PRIMARY KEY (old_id); |
111 | 110 | |
112 | 111 | CREATE TABLE &mw_prefix.archive ( |
113 | | - ar_namespace NUMBER NOT NULL, |
| 112 | + ar_namespace NUMBER DEFAULT 0 NOT NULL, |
114 | 113 | ar_title VARCHAR2(255) NOT NULL, |
115 | 114 | ar_text CLOB, |
116 | 115 | ar_comment VARCHAR2(255), |
117 | | - ar_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL, |
| 116 | + ar_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, |
118 | 117 | ar_user_text VARCHAR2(255) NOT NULL, |
119 | 118 | ar_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL, |
120 | 119 | ar_minor_edit CHAR(1) DEFAULT '0' NOT NULL, |
121 | 120 | ar_flags VARCHAR2(255), |
122 | 121 | ar_rev_id NUMBER, |
123 | 122 | ar_text_id NUMBER, |
124 | | - ar_deleted NUMBER DEFAULT '0' NOT NULL, |
| 123 | + ar_deleted CHAR(1) DEFAULT '0' NOT NULL, |
125 | 124 | ar_len NUMBER, |
126 | 125 | ar_page_id NUMBER, |
127 | 126 | ar_parent_id NUMBER |
— | — | @@ -130,23 +129,23 @@ |
131 | 130 | CREATE INDEX &mw_prefix.archive_i03 ON &mw_prefix.archive (ar_namespace, ar_title, ar_rev_id); |
132 | 131 | |
133 | 132 | CREATE TABLE &mw_prefix.pagelinks ( |
134 | | - pl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE, |
135 | | - pl_namespace NUMBER NOT NULL, |
| 133 | + pl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
| 134 | + pl_namespace NUMBER DEFAULT 0 NOT NULL, |
136 | 135 | pl_title VARCHAR2(255) NOT NULL |
137 | 136 | ); |
138 | 137 | CREATE UNIQUE INDEX &mw_prefix.pagelinks_u01 ON &mw_prefix.pagelinks (pl_from,pl_namespace,pl_title); |
139 | 138 | CREATE UNIQUE INDEX &mw_prefix.pagelinks_u02 ON &mw_prefix.pagelinks (pl_namespace,pl_title,pl_from); |
140 | 139 | |
141 | 140 | CREATE TABLE &mw_prefix.templatelinks ( |
142 | | - tl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE, |
143 | | - tl_namespace NUMBER NOT NULL, |
| 141 | + tl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
| 142 | + tl_namespace NUMBER DEFAULT 0 NOT NULL, |
144 | 143 | tl_title VARCHAR2(255) NOT NULL |
145 | 144 | ); |
146 | 145 | CREATE UNIQUE INDEX &mw_prefix.templatelinks_u01 ON &mw_prefix.templatelinks (tl_from,tl_namespace,tl_title); |
147 | 146 | CREATE UNIQUE INDEX &mw_prefix.templatelinks_u02 ON &mw_prefix.templatelinks (tl_namespace,tl_title,tl_from); |
148 | 147 | |
149 | 148 | CREATE TABLE &mw_prefix.imagelinks ( |
150 | | - il_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE, |
| 149 | + il_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
151 | 150 | il_to VARCHAR2(255) NOT NULL |
152 | 151 | ); |
153 | 152 | CREATE UNIQUE INDEX &mw_prefix.imagelinks_u01 ON &mw_prefix.imagelinks (il_from,il_to); |
— | — | @@ -154,7 +153,7 @@ |
155 | 154 | |
156 | 155 | |
157 | 156 | CREATE TABLE &mw_prefix.categorylinks ( |
158 | | - cl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE, |
| 157 | + cl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
159 | 158 | cl_to VARCHAR2(255) NOT NULL, |
160 | 159 | cl_sortkey VARCHAR2(230), |
161 | 160 | cl_sortkey_prefix VARCHAR2(255) DEFAULT '' NOT NULL, |
— | — | @@ -181,7 +180,7 @@ |
182 | 181 | CREATE INDEX &mw_prefix.category_i01 ON &mw_prefix.category (cat_pages); |
183 | 182 | |
184 | 183 | CREATE TABLE &mw_prefix.externallinks ( |
185 | | - el_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE, |
| 184 | + el_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
186 | 185 | el_to VARCHAR2(2048) NOT NULL, |
187 | 186 | el_index VARCHAR2(2048) NOT NULL |
188 | 187 | ); |
— | — | @@ -197,7 +196,7 @@ |
198 | 197 | CREATE UNIQUE INDEX &mw_prefix.external_user_u01 ON &mw_prefix.external_user (eu_external_id); |
199 | 198 | |
200 | 199 | CREATE TABLE &mw_prefix.langlinks ( |
201 | | - ll_from NUMBER NOT NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE, |
| 200 | + ll_from NUMBER NOT NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
202 | 201 | ll_lang VARCHAR2(20), |
203 | 202 | ll_title VARCHAR2(255) |
204 | 203 | ); |
— | — | @@ -233,8 +232,8 @@ |
234 | 233 | CREATE TABLE &mw_prefix.ipblocks ( |
235 | 234 | ipb_id NUMBER NOT NULL, |
236 | 235 | ipb_address VARCHAR2(255) NULL, |
237 | | - ipb_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL, |
238 | | - ipb_by NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE, |
| 236 | + ipb_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, |
| 237 | + ipb_by NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
239 | 238 | ipb_by_text VARCHAR2(255) NOT NULL, |
240 | 239 | ipb_reason VARCHAR2(255) NOT NULL, |
241 | 240 | ipb_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL, |
— | — | @@ -258,19 +257,19 @@ |
259 | 258 | |
260 | 259 | CREATE TABLE &mw_prefix.image ( |
261 | 260 | img_name VARCHAR2(255) NOT NULL, |
262 | | - img_size NUMBER NOT NULL, |
263 | | - img_width NUMBER NOT NULL, |
264 | | - img_height NUMBER NOT NULL, |
| 261 | + img_size NUMBER DEFAULT 0 NOT NULL, |
| 262 | + img_width NUMBER DEFAULT 0 NOT NULL, |
| 263 | + img_height NUMBER DEFAULT 0 NOT NULL, |
265 | 264 | img_metadata CLOB, |
266 | | - img_bits NUMBER, |
| 265 | + img_bits NUMBER DEFAULT 0 NOT NULL, |
267 | 266 | img_media_type VARCHAR2(32), |
268 | 267 | img_major_mime VARCHAR2(32) DEFAULT 'unknown', |
269 | 268 | img_minor_mime VARCHAR2(100) DEFAULT 'unknown', |
270 | 269 | img_description VARCHAR2(255), |
271 | | - img_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL, |
| 270 | + img_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, |
272 | 271 | img_user_text VARCHAR2(255) NOT NULL, |
273 | 272 | img_timestamp TIMESTAMP(6) WITH TIME ZONE, |
274 | | - img_sha1 VARCHAR2(32) |
| 273 | + img_sha1 VARCHAR2(32) |
275 | 274 | ); |
276 | 275 | ALTER TABLE &mw_prefix.image ADD CONSTRAINT &mw_prefix.image_pk PRIMARY KEY (img_name); |
277 | 276 | CREATE INDEX &mw_prefix.image_i01 ON &mw_prefix.image (img_user_text,img_timestamp); |
— | — | @@ -280,14 +279,14 @@ |
281 | 280 | |
282 | 281 | |
283 | 282 | CREATE TABLE &mw_prefix.oldimage ( |
284 | | - oi_name VARCHAR2(255) NOT NULL REFERENCES &mw_prefix.image(img_name), |
| 283 | + oi_name VARCHAR2(255) DEFAULT 0 NOT NULL REFERENCES &mw_prefix.image(img_name) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, |
285 | 284 | oi_archive_name VARCHAR2(255), |
286 | | - oi_size NUMBER NOT NULL, |
287 | | - oi_width NUMBER NOT NULL, |
288 | | - oi_height NUMBER NOT NULL, |
289 | | - oi_bits NUMBER NOT NULL, |
| 285 | + oi_size NUMBER DEFAULT 0 NOT NULL, |
| 286 | + oi_width NUMBER DEFAULT 0 NOT NULL, |
| 287 | + oi_height NUMBER DEFAULT 0 NOT NULL, |
| 288 | + oi_bits NUMBER DEFAULT 0 NOT NULL, |
290 | 289 | oi_description VARCHAR2(255), |
291 | | - oi_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL, |
| 290 | + oi_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, |
292 | 291 | oi_user_text VARCHAR2(255) NOT NULL, |
293 | 292 | oi_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL, |
294 | 293 | oi_metadata CLOB, |
— | — | @@ -310,22 +309,22 @@ |
311 | 310 | fa_archive_name VARCHAR2(255), |
312 | 311 | fa_storage_group VARCHAR2(16), |
313 | 312 | fa_storage_key VARCHAR2(64), |
314 | | - fa_deleted_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL, |
| 313 | + fa_deleted_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, |
315 | 314 | fa_deleted_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL, |
316 | 315 | fa_deleted_reason CLOB, |
317 | | - fa_size NUMBER NOT NULL, |
318 | | - fa_width NUMBER NOT NULL, |
319 | | - fa_height NUMBER NOT NULL, |
| 316 | + fa_size NUMBER DEFAULT 0 NOT NULL, |
| 317 | + fa_width NUMBER DEFAULT 0 NOT NULL, |
| 318 | + fa_height NUMBER DEFAULT 0 NOT NULL, |
320 | 319 | fa_metadata CLOB, |
321 | | - fa_bits NUMBER, |
| 320 | + fa_bits NUMBER DEFAULT 0 NOT NULL, |
322 | 321 | fa_media_type VARCHAR2(32) DEFAULT NULL, |
323 | 322 | fa_major_mime VARCHAR2(32) DEFAULT 'unknown', |
324 | 323 | fa_minor_mime VARCHAR2(100) DEFAULT 'unknown', |
325 | 324 | fa_description VARCHAR2(255), |
326 | | - fa_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL, |
| 325 | + fa_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, |
327 | 326 | fa_user_text VARCHAR2(255) NOT NULL, |
328 | 327 | fa_timestamp TIMESTAMP(6) WITH TIME ZONE, |
329 | | - fa_deleted NUMBER DEFAULT '0' NOT NULL |
| 328 | + fa_deleted NUMBER DEFAULT 0 NOT NULL |
330 | 329 | ); |
331 | 330 | ALTER TABLE &mw_prefix.filearchive ADD CONSTRAINT &mw_prefix.filearchive_pk PRIMARY KEY (fa_id); |
332 | 331 | CREATE INDEX &mw_prefix.filearchive_i01 ON &mw_prefix.filearchive (fa_name, fa_timestamp); |
— | — | @@ -338,26 +337,26 @@ |
339 | 338 | rc_id NUMBER NOT NULL, |
340 | 339 | rc_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL, |
341 | 340 | rc_cur_time TIMESTAMP(6) WITH TIME ZONE NOT NULL, |
342 | | - rc_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL, |
| 341 | + rc_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, |
343 | 342 | rc_user_text VARCHAR2(255) NOT NULL, |
344 | | - rc_namespace NUMBER NOT NULL, |
| 343 | + rc_namespace NUMBER DEFAULT 0 NOT NULL, |
345 | 344 | rc_title VARCHAR2(255) NOT NULL, |
346 | 345 | rc_comment VARCHAR2(255), |
347 | 346 | rc_minor CHAR(1) DEFAULT '0' NOT NULL, |
348 | 347 | rc_bot CHAR(1) DEFAULT '0' NOT NULL, |
349 | 348 | rc_new CHAR(1) DEFAULT '0' NOT NULL, |
350 | | - rc_cur_id NUMBER NULL REFERENCES &mw_prefix.page(page_id) ON DELETE SET NULL, |
351 | | - rc_this_oldid NUMBER NOT NULL, |
352 | | - rc_last_oldid NUMBER NOT NULL, |
| 349 | + rc_cur_id NUMBER DEFAULT 0 NOT NULL, |
| 350 | + rc_this_oldid NUMBER DEFAULT 0 NOT NULL, |
| 351 | + rc_last_oldid NUMBER DEFAULT 0 NOT NULL, |
353 | 352 | rc_type CHAR(1) DEFAULT '0' NOT NULL, |
354 | | - rc_moved_to_ns NUMBER, |
| 353 | + rc_moved_to_ns NUMBER DEFAULT 0 NOT NULL, |
355 | 354 | rc_moved_to_title VARCHAR2(255), |
356 | 355 | rc_patrolled CHAR(1) DEFAULT '0' NOT NULL, |
357 | 356 | rc_ip VARCHAR2(15), |
358 | 357 | rc_old_len NUMBER, |
359 | 358 | rc_new_len NUMBER, |
360 | | - rc_deleted NUMBER DEFAULT '0' NOT NULL, |
361 | | - rc_logid NUMBER DEFAULT '0' NOT NULL, |
| 359 | + rc_deleted CHAR(1) DEFAULT '0' NOT NULL, |
| 360 | + rc_logid NUMBER DEFAULT 0 NOT NULL, |
362 | 361 | rc_log_type VARCHAR2(255), |
363 | 362 | rc_log_action VARCHAR2(255), |
364 | 363 | rc_params CLOB |
— | — | @@ -372,7 +371,7 @@ |
373 | 372 | CREATE INDEX &mw_prefix.recentchanges_i07 ON &mw_prefix.recentchanges (rc_user_text, rc_timestamp); |
374 | 373 | |
375 | 374 | CREATE TABLE &mw_prefix.watchlist ( |
376 | | - wl_user NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE, |
| 375 | + wl_user NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
377 | 376 | wl_namespace NUMBER DEFAULT 0 NOT NULL, |
378 | 377 | wl_title VARCHAR2(255) NOT NULL, |
379 | 378 | wl_notificationtimestamp TIMESTAMP(6) WITH TIME ZONE |
— | — | @@ -409,8 +408,8 @@ |
410 | 409 | |
411 | 410 | CREATE TABLE &mw_prefix.querycache ( |
412 | 411 | qc_type VARCHAR2(32) NOT NULL, |
413 | | - qc_value NUMBER NOT NULL, |
414 | | - qc_namespace NUMBER NOT NULL, |
| 412 | + qc_value NUMBER DEFAULT 0 NOT NULL, |
| 413 | + qc_namespace NUMBER DEFAULT 0 NOT NULL, |
415 | 414 | qc_title VARCHAR2(255) NOT NULL |
416 | 415 | ); |
417 | 416 | CREATE INDEX &mw_prefix.querycache_u01 ON &mw_prefix.querycache (qc_type,qc_value); |
— | — | @@ -436,14 +435,14 @@ |
437 | 436 | log_type VARCHAR2(10) NOT NULL, |
438 | 437 | log_action VARCHAR2(10) NOT NULL, |
439 | 438 | log_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL, |
440 | | - log_user NUMBER REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL, |
| 439 | + log_user NUMBER DEFAULT 0 NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, |
441 | 440 | log_user_text VARCHAR2(255), |
442 | | - log_namespace NUMBER NOT NULL, |
| 441 | + log_namespace NUMBER DEFAULT 0 NOT NULL, |
443 | 442 | log_title VARCHAR2(255) NOT NULL, |
444 | 443 | log_page NUMBER, |
445 | 444 | log_comment VARCHAR2(255), |
446 | 445 | log_params CLOB, |
447 | | - log_deleted NUMBER DEFAULT '0' NOT NULL |
| 446 | + log_deleted CHAR(1) DEFAULT '0' NOT NULL |
448 | 447 | ); |
449 | 448 | ALTER TABLE &mw_prefix.logging ADD CONSTRAINT &mw_prefix.logging_pk PRIMARY KEY (log_id); |
450 | 449 | CREATE INDEX &mw_prefix.logging_i01 ON &mw_prefix.logging (log_type, log_timestamp); |
— | — | @@ -462,7 +461,7 @@ |
463 | 462 | CREATE SEQUENCE trackbacks_tb_id_seq; |
464 | 463 | CREATE TABLE &mw_prefix.trackbacks ( |
465 | 464 | tb_id NUMBER NOT NULL, |
466 | | - tb_page NUMBER REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE, |
| 465 | + tb_page NUMBER REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
467 | 466 | tb_title VARCHAR2(255) NOT NULL, |
468 | 467 | tb_url VARCHAR2(255) NOT NULL, |
469 | 468 | tb_ex CLOB, |
— | — | @@ -475,7 +474,7 @@ |
476 | 475 | CREATE TABLE &mw_prefix.job ( |
477 | 476 | job_id NUMBER NOT NULL, |
478 | 477 | job_cmd VARCHAR2(60) NOT NULL, |
479 | | - job_namespace NUMBER NOT NULL, |
| 478 | + job_namespace NUMBER DEFAULT 0 NOT NULL, |
480 | 479 | job_title VARCHAR2(255) NOT NULL, |
481 | 480 | job_params CLOB NOT NULL |
482 | 481 | ); |
— | — | @@ -489,8 +488,8 @@ |
490 | 489 | CREATE UNIQUE INDEX &mw_prefix.querycache_info_u01 ON &mw_prefix.querycache_info (qci_type); |
491 | 490 | |
492 | 491 | CREATE TABLE &mw_prefix.redirect ( |
493 | | - rd_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE, |
494 | | - rd_namespace NUMBER NOT NULL, |
| 492 | + rd_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
| 493 | + rd_namespace NUMBER DEFAULT 0 NOT NULL, |
495 | 494 | rd_title VARCHAR2(255) NOT NULL, |
496 | 495 | rd_interwiki VARCHAR2(32), |
497 | 496 | rd_fragment VARCHAR2(255) |
— | — | @@ -512,7 +511,7 @@ |
513 | 512 | CREATE SEQUENCE page_restrictions_pr_id_seq; |
514 | 513 | CREATE TABLE &mw_prefix.page_restrictions ( |
515 | 514 | pr_id NUMBER NOT NULL, |
516 | | - pr_page NUMBER NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE, |
| 515 | + pr_page NUMBER NOT NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, |
517 | 516 | pr_type VARCHAR2(255) NOT NULL, |
518 | 517 | pr_level VARCHAR2(255) NOT NULL, |
519 | 518 | pr_cascade NUMBER NOT NULL, |
— | — | @@ -525,7 +524,7 @@ |
526 | 525 | CREATE INDEX &mw_prefix.page_restrictions_i03 ON &mw_prefix.page_restrictions (pr_cascade); |
527 | 526 | |
528 | 527 | CREATE TABLE &mw_prefix.protected_titles ( |
529 | | - pt_namespace NUMBER NOT NULL, |
| 528 | + pt_namespace NUMBER DEFAULT 0 NOT NULL, |
530 | 529 | pt_title VARCHAR2(255) NOT NULL, |
531 | 530 | pt_user NUMBER NOT NULL, |
532 | 531 | pt_reason VARCHAR2(255), |
— | — | @@ -689,6 +688,7 @@ |
690 | 689 | p_temporary IN BOOLEAN) IS |
691 | 690 | e_table_not_exist EXCEPTION; |
692 | 691 | PRAGMA EXCEPTION_INIT(e_table_not_exist, -00942); |
| 692 | + l_temp_ei_sql VARCHAR2(2000); |
693 | 693 | BEGIN |
694 | 694 | BEGIN |
695 | 695 | EXECUTE IMMEDIATE 'DROP TABLE ' || p_newprefix || p_tabname || |
— | — | @@ -712,7 +712,7 @@ |
713 | 713 | AND data_default IS NOT NULL) LOOP |
714 | 714 | EXECUTE IMMEDIATE 'ALTER TABLE ' || p_newprefix || p_tabname || |
715 | 715 | ' MODIFY ' || rc.column_name || ' DEFAULT ' || |
716 | | - substr(rc.data_default, 1, 2000); |
| 716 | + SUBSTR(rc.data_default, 1, 2000); |
717 | 717 | END LOOP; |
718 | 718 | FOR rc IN (SELECT REPLACE(REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('CONSTRAINT', |
719 | 719 | constraint_name), |
— | — | @@ -726,11 +726,11 @@ |
727 | 727 | FROM user_constraints uc |
728 | 728 | WHERE table_name = p_oldprefix || p_tabname |
729 | 729 | AND constraint_type = 'P') LOOP |
730 | | - dbms_output.put_line(SUBSTR(rc.ddlvc2, |
731 | | - 1, |
732 | | - INSTR(rc.ddlvc2, 'PCTFREE') - 1)); |
733 | | - EXECUTE IMMEDIATE SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1); |
| 730 | + l_temp_ei_sql := SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1); |
| 731 | + l_temp_ei_sql := SUBSTR(l_temp_ei_sql, 1, INSTR(l_temp_ei_sql, ')', INSTR(l_temp_ei_sql, 'PRIMARY KEY')+1)+1); |
| 732 | + EXECUTE IMMEDIATE l_temp_ei_sql; |
734 | 733 | END LOOP; |
| 734 | + IF (NOT p_temporary) THEN |
735 | 735 | FOR rc IN (SELECT REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('REF_CONSTRAINT', |
736 | 736 | constraint_name), |
737 | 737 | 32767, |
— | — | @@ -743,6 +743,7 @@ |
744 | 744 | AND constraint_type = 'R') LOOP |
745 | 745 | EXECUTE IMMEDIATE rc.ddlvc2; |
746 | 746 | END LOOP; |
| 747 | + END IF; |
747 | 748 | FOR rc IN (SELECT REPLACE(REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('INDEX', |
748 | 749 | index_name), |
749 | 750 | 32767, |
— | — | @@ -751,16 +752,19 @@ |
752 | 753 | USER || '"."' || p_newprefix), |
753 | 754 | '"' || index_name || '"', |
754 | 755 | '"' || p_newprefix || index_name || '"') DDLVC2, |
755 | | - index_name |
| 756 | + index_name, |
| 757 | + index_type |
756 | 758 | FROM user_indexes ui |
757 | 759 | WHERE table_name = p_oldprefix || p_tabname |
758 | | - AND index_type != 'LOB' |
| 760 | + AND index_type NOT IN ('LOB', 'DOMAIN') |
759 | 761 | AND NOT EXISTS |
760 | 762 | (SELECT NULL |
761 | 763 | FROM user_constraints |
762 | 764 | WHERE table_name = ui.table_name |
763 | 765 | AND constraint_name = ui.index_name)) LOOP |
764 | | - EXECUTE IMMEDIATE SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1); |
| 766 | + l_temp_ei_sql := SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1); |
| 767 | + 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); |
| 768 | + EXECUTE IMMEDIATE l_temp_ei_sql; |
765 | 769 | END LOOP; |
766 | 770 | FOR rc IN (SELECT REPLACE(REPLACE(UPPER(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('TRIGGER', |
767 | 771 | trigger_name), |
— | — | @@ -773,18 +777,14 @@ |
774 | 778 | trigger_name |
775 | 779 | FROM user_triggers |
776 | 780 | WHERE table_name = p_oldprefix || p_tabname) LOOP |
777 | | - EXECUTE IMMEDIATE SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'ALTER ') - 1); |
| 781 | + l_temp_ei_sql := SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'ALTER ') - 1); |
| 782 | + dbms_output.put_line(l_temp_ei_sql); |
| 783 | + EXECUTE IMMEDIATE l_temp_ei_sql; |
778 | 784 | END LOOP; |
779 | 785 | END; |
780 | 786 | /*$mw$*/ |
781 | 787 | |
782 | 788 | /*$mw$*/ |
783 | | -BEGIN |
784 | | - fill_wiki_info; |
785 | | -END; |
786 | | -/*$mw$*/ |
787 | | - |
788 | | -/*$mw$*/ |
789 | 789 | CREATE OR REPLACE FUNCTION BITOR (x IN NUMBER, y IN NUMBER) RETURN NUMBER AS |
790 | 790 | BEGIN |
791 | 791 | RETURN (x + y - BITAND(x, y)); |
Index: trunk/phase3/includes/installer/OracleUpdater.php |
— | — | @@ -14,6 +14,37 @@ |
15 | 15 | */ |
16 | 16 | class OracleUpdater extends DatabaseUpdater { |
17 | 17 | protected function getCoreUpdateList() { |
18 | | - return array(); |
| 18 | + return array( |
| 19 | + // 1.16 |
| 20 | + array( 'doNamespaceDefaults' ), |
| 21 | + ); |
19 | 22 | } |
| 23 | + |
| 24 | + |
| 25 | + /** |
| 26 | + * MySQL uses datatype defaults for NULL inserted into NOT NULL fields |
| 27 | + * In namespace case that results into insert of 0 which is default namespace |
| 28 | + * Oracle inserts NULL, so namespace fields should have a default value |
| 29 | + */ |
| 30 | + protected function doNamespaceDefaults() { |
| 31 | + $meta = $this->db->fieldInfo( 'page', 'page_namespace' ); |
| 32 | + if ( $meta->defaultValue() != null ) { |
| 33 | + $this->output( "... defaults seem to present on namespace fields\n" ); |
| 34 | + return; |
| 35 | + } |
| 36 | + |
| 37 | + $this->output( "Altering namespace fields with default value ..." ); |
| 38 | + $this->applyPatch( 'patch_namespace_defaults.sql', false ); |
| 39 | + $this->output( "ok\n" ); |
| 40 | + } |
| 41 | + |
| 42 | + /** |
| 43 | + * Overload: after this action field info table has to be rebuilt |
| 44 | + */ |
| 45 | + public function doUpdates( $purge = true ) { |
| 46 | + parent::doUpdates(); |
| 47 | + |
| 48 | + $this->db->doQuery( 'BEGIN fill_wiki_info; END;' ); |
| 49 | + } |
| 50 | + |
20 | 51 | } |
Index: trunk/phase3/includes/installer/Installer.php |
— | — | @@ -358,6 +358,20 @@ |
359 | 359 | LBFactory::enableBackend(); |
360 | 360 | } |
361 | 361 | |
| 362 | + |
| 363 | + $titleobj = Title::newFromText( wfMsgNoDB( "mainpage" ) ); |
| 364 | + $article = new Article( $titleobj ); |
| 365 | + $newid = $article->insertOn( $installer->db ); |
| 366 | + $revision = new Revision( array( |
| 367 | + 'page' => $newid, |
| 368 | + 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsgNoTrans( 'mainpagedocfooter' ), |
| 369 | + 'comment' => '', |
| 370 | + 'user' => 0, |
| 371 | + 'user_text' => 'MediaWiki default', |
| 372 | + ) ); |
| 373 | + $revid = $revision->insertOn( $installer->db ); |
| 374 | + $article->updateRevisionOn( $installer->db, $revision ); |
| 375 | + |
362 | 376 | return $status; |
363 | 377 | } |
364 | 378 | |
Index: trunk/phase3/includes/installer/OracleInstaller.php |
— | — | @@ -189,16 +189,25 @@ |
190 | 190 | |
191 | 191 | return $status; |
192 | 192 | } |
| 193 | + |
| 194 | + /** |
| 195 | + * Overload: after this action field info table has to be rebuilt |
| 196 | + */ |
| 197 | + public function createTables() { |
| 198 | + $status = parent::createTables(); |
| 199 | + |
| 200 | + $this->db->doQuery( 'BEGIN fill_wiki_info; END;' ); |
| 201 | + |
| 202 | + return $status; |
| 203 | + } |
| 204 | + |
193 | 205 | |
194 | 206 | public function getLocalSettings() { |
195 | 207 | $prefix = $this->getVar( 'wgDBprefix' ); |
196 | 208 | return |
197 | 209 | "# Oracle specific settings |
198 | | -\$wgDBprefix = \"{$prefix}\";"; |
| 210 | +\$wgDBprefix = \"{$prefix}\"; |
| 211 | +"; |
199 | 212 | } |
200 | 213 | |
201 | | - public function doUpgrade() { |
202 | | - // TODO |
203 | | - return false; |
204 | | - } |
205 | 214 | } |
Index: trunk/phase3/config/new-index.php |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | */ |
8 | 8 | |
9 | 9 | define( 'MW_CONFIG_CALLBACK', 'CoreInstaller::overrideConfig' ); |
| 10 | +define( 'MEDIAWIKI_INSTALL', true ); |
10 | 11 | |
11 | 12 | chdir( ".." ); |
12 | 13 | require( './includes/WebStart.php' ); |