r72535 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72534‎ | r72535 | r72536 >
Date:12:46, 7 September 2010
Author:demon
Status:ok
Tags:
Comment:
Move ora to oracle. Stuff expects these directories to match $wgDBtype
Modified paths:
  • /trunk/phase3/maintenance/ora (deleted) (history)
  • /trunk/phase3/maintenance/oracle (added) (history)

Diff [purge]

Index: trunk/phase3/maintenance/oracle/patch_seq_names_pre1.16.sql
@@ -0,0 +1,8 @@
 2+-- script for renameing sequence names to conform with <table>_<field>_seq format
 3+RENAME rev_rev_id_val TO revision_rev_id_seq;
 4+RENAME text_old_id_val TO text_old_id_seq;
 5+RENAME category_id_seq TO category_cat_id_seq;
 6+RENAME ipblocks_ipb_id_val TO ipblocks_ipb_id_seq;
 7+RENAME rc_rc_id_seq TO recentchanges_rc_id_seq;
 8+RENAME log_log_id_seq TO logging_log_id_seq;
 9+RENAME pr_id_val TO page_restrictions_pr_id_seq;
\ No newline at end of file
Property changes on: trunk/phase3/maintenance/oracle/patch_seq_names_pre1.16.sql
___________________________________________________________________
Added: svn:eol-style
110 + native
Index: trunk/phase3/maintenance/oracle/tables.sql
@@ -0,0 +1,794 @@
 2+-- defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}';
 3+define mw_prefix='{$wgDBprefix}';
 4+
 5+
 6+CREATE SEQUENCE user_user_id_seq MINVALUE 0 START WITH 0;
 7+CREATE TABLE &mw_prefix.mwuser ( -- replace reserved word 'user'
 8+ user_id NUMBER NOT NULL,
 9+ user_name VARCHAR2(255) NOT NULL,
 10+ user_real_name VARCHAR2(512),
 11+ user_password VARCHAR2(255),
 12+ user_newpassword VARCHAR2(255),
 13+ user_newpass_time TIMESTAMP(6) WITH TIME ZONE,
 14+ user_token VARCHAR2(32),
 15+ user_email VARCHAR2(255),
 16+ user_email_token VARCHAR2(32),
 17+ user_email_token_expires TIMESTAMP(6) WITH TIME ZONE,
 18+ user_email_authenticated TIMESTAMP(6) WITH TIME ZONE,
 19+ user_options CLOB,
 20+ user_touched TIMESTAMP(6) WITH TIME ZONE,
 21+ user_registration TIMESTAMP(6) WITH TIME ZONE,
 22+ user_editcount NUMBER
 23+);
 24+ALTER TABLE &mw_prefix.mwuser ADD CONSTRAINT &mw_prefix.mwuser_pk PRIMARY KEY (user_id);
 25+CREATE UNIQUE INDEX &mw_prefix.mwuser_u01 ON &mw_prefix.mwuser (user_name);
 26+CREATE INDEX &mw_prefix.mwuser_i01 ON &mw_prefix.mwuser (user_email_token);
 27+
 28+-- Create a dummy user to satisfy fk contraints especially with revisions
 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);
 31+
 32+CREATE TABLE &mw_prefix.user_groups (
 33+ ug_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE,
 34+ ug_group VARCHAR2(16) NOT NULL
 35+);
 36+CREATE UNIQUE INDEX &mw_prefix.user_groups_u01 ON &mw_prefix.user_groups (ug_user,ug_group);
 37+CREATE INDEX &mw_prefix.user_groups_i01 ON &mw_prefix.user_groups (ug_group);
 38+
 39+CREATE TABLE &mw_prefix.user_newtalk (
 40+ user_id NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE,
 41+ user_ip VARCHAR2(40) NULL,
 42+ user_last_timestamp TIMESTAMP(6) WITH TIME ZONE
 43+);
 44+CREATE INDEX &mw_prefix.user_newtalk_i01 ON &mw_prefix.user_newtalk (user_id);
 45+CREATE INDEX &mw_prefix.user_newtalk_i02 ON &mw_prefix.user_newtalk (user_ip);
 46+
 47+CREATE TABLE &mw_prefix.user_properties (
 48+ up_user NUMBER NOT NULL,
 49+ up_property VARCHAR2(32) NOT NULL,
 50+ up_value CLOB
 51+);
 52+CREATE UNIQUE INDEX &mw_prefix.user_properties_u01 on &mw_prefix.user_properties (up_user,up_property);
 53+CREATE INDEX &mw_prefix.user_properties_i01 on &mw_prefix.user_properties (up_property);
 54+
 55+
 56+CREATE SEQUENCE page_page_id_seq;
 57+CREATE TABLE &mw_prefix.page (
 58+ page_id NUMBER NOT NULL,
 59+ page_namespace NUMBER NOT NULL,
 60+ page_title VARCHAR2(255) NOT NULL,
 61+ page_restrictions VARCHAR2(255),
 62+ 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,
 65+ page_random NUMBER(15,14) NOT NULL,
 66+ page_touched TIMESTAMP(6) WITH TIME ZONE,
 67+ page_latest NUMBER NOT NULL, -- FK?
 68+ page_len NUMBER NOT NULL
 69+);
 70+ALTER TABLE &mw_prefix.page ADD CONSTRAINT &mw_prefix.page_pk PRIMARY KEY (page_id);
 71+CREATE UNIQUE INDEX &mw_prefix.page_u01 ON &mw_prefix.page (page_namespace,page_title);
 72+CREATE INDEX &mw_prefix.page_i01 ON &mw_prefix.page (page_random);
 73+CREATE INDEX &mw_prefix.page_i02 ON &mw_prefix.page (page_len);
 74+
 75+/*$mw$*/
 76+CREATE TRIGGER &mw_prefix.page_set_random BEFORE INSERT ON &mw_prefix.page
 77+ FOR EACH ROW WHEN (new.page_random IS NULL)
 78+BEGIN
 79+ SELECT dbms_random.value INTO :NEW.page_random FROM dual;
 80+END;
 81+/*$mw$*/
 82+
 83+CREATE SEQUENCE revision_rev_id_seq;
 84+CREATE TABLE &mw_prefix.revision (
 85+ rev_id NUMBER NOT NULL,
 86+ rev_page NUMBER NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE,
 87+ rev_text_id NUMBER NULL,
 88+ rev_comment VARCHAR2(255),
 89+ rev_user NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id),
 90+ rev_user_text VARCHAR2(255) NOT NULL,
 91+ rev_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
 92+ rev_minor_edit CHAR(1) DEFAULT '0' NOT NULL,
 93+ rev_deleted CHAR(1) DEFAULT '0' NOT NULL,
 94+ rev_len NUMBER NULL,
 95+ rev_parent_id NUMBER DEFAULT NULL
 96+);
 97+ALTER TABLE &mw_prefix.revision ADD CONSTRAINT &mw_prefix.revision_pk PRIMARY KEY (rev_id);
 98+CREATE UNIQUE INDEX &mw_prefix.revision_u01 ON &mw_prefix.revision (rev_page, rev_id);
 99+CREATE INDEX &mw_prefix.revision_i01 ON &mw_prefix.revision (rev_timestamp);
 100+CREATE INDEX &mw_prefix.revision_i02 ON &mw_prefix.revision (rev_page,rev_timestamp);
 101+CREATE INDEX &mw_prefix.revision_i03 ON &mw_prefix.revision (rev_user,rev_timestamp);
 102+CREATE INDEX &mw_prefix.revision_i04 ON &mw_prefix.revision (rev_user_text,rev_timestamp);
 103+
 104+CREATE SEQUENCE text_old_id_seq;
 105+CREATE TABLE &mw_prefix.pagecontent ( -- replaces reserved word 'text'
 106+ old_id NUMBER NOT NULL,
 107+ old_text CLOB,
 108+ old_flags VARCHAR2(255)
 109+);
 110+ALTER TABLE &mw_prefix.pagecontent ADD CONSTRAINT &mw_prefix.pagecontent_pk PRIMARY KEY (old_id);
 111+
 112+CREATE TABLE &mw_prefix.archive (
 113+ ar_namespace NUMBER NOT NULL,
 114+ ar_title VARCHAR2(255) NOT NULL,
 115+ ar_text CLOB,
 116+ ar_comment VARCHAR2(255),
 117+ ar_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 118+ ar_user_text VARCHAR2(255) NOT NULL,
 119+ ar_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
 120+ ar_minor_edit CHAR(1) DEFAULT '0' NOT NULL,
 121+ ar_flags VARCHAR2(255),
 122+ ar_rev_id NUMBER,
 123+ ar_text_id NUMBER,
 124+ ar_deleted NUMBER DEFAULT '0' NOT NULL,
 125+ ar_len NUMBER,
 126+ ar_page_id NUMBER,
 127+ ar_parent_id NUMBER
 128+);
 129+CREATE INDEX &mw_prefix.archive_i01 ON &mw_prefix.archive (ar_namespace,ar_title,ar_timestamp);
 130+CREATE INDEX &mw_prefix.archive_i02 ON &mw_prefix.archive (ar_user_text,ar_timestamp);
 131+
 132+
 133+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,
 136+ pl_title VARCHAR2(255) NOT NULL
 137+);
 138+CREATE UNIQUE INDEX &mw_prefix.pagelinks_u01 ON &mw_prefix.pagelinks (pl_from,pl_namespace,pl_title);
 139+CREATE UNIQUE INDEX &mw_prefix.pagelinks_u02 ON &mw_prefix.pagelinks (pl_namespace,pl_title,pl_from);
 140+
 141+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,
 144+ tl_title VARCHAR2(255) NOT NULL
 145+);
 146+CREATE UNIQUE INDEX &mw_prefix.templatelinks_u01 ON &mw_prefix.templatelinks (tl_from,tl_namespace,tl_title);
 147+CREATE UNIQUE INDEX &mw_prefix.templatelinks_u02 ON &mw_prefix.templatelinks (tl_namespace,tl_title,tl_from);
 148+
 149+CREATE TABLE &mw_prefix.imagelinks (
 150+ il_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
 151+ il_to VARCHAR2(255) NOT NULL
 152+);
 153+CREATE UNIQUE INDEX &mw_prefix.imagelinks_u01 ON &mw_prefix.imagelinks (il_from,il_to);
 154+CREATE UNIQUE INDEX &mw_prefix.imagelinks_u02 ON &mw_prefix.imagelinks (il_to,il_from);
 155+
 156+
 157+CREATE TABLE &mw_prefix.categorylinks (
 158+ cl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
 159+ cl_to VARCHAR2(255) NOT NULL,
 160+ cl_sortkey VARCHAR2(255),
 161+ cl_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL
 162+);
 163+CREATE UNIQUE INDEX &mw_prefix.categorylinks_u01 ON &mw_prefix.categorylinks (cl_from,cl_to);
 164+CREATE INDEX &mw_prefix.categorylinks_i01 ON &mw_prefix.categorylinks (cl_to,cl_sortkey,cl_from);
 165+CREATE INDEX &mw_prefix.categorylinks_i02 ON &mw_prefix.categorylinks (cl_to,cl_timestamp);
 166+
 167+CREATE SEQUENCE category_cat_id_seq;
 168+CREATE TABLE &mw_prefix.category (
 169+ cat_id NUMBER NOT NULL,
 170+ cat_title VARCHAR2(255) NOT NULL,
 171+ cat_pages NUMBER DEFAULT 0 NOT NULL,
 172+ cat_subcats NUMBER DEFAULT 0 NOT NULL,
 173+ cat_files NUMBER DEFAULT 0 NOT NULL,
 174+ cat_hidden NUMBER DEFAULT 0 NOT NULL
 175+);
 176+ALTER TABLE &mw_prefix.category ADD CONSTRAINT &mw_prefix.category_pk PRIMARY KEY (cat_id);
 177+CREATE UNIQUE INDEX &mw_prefix.category_u01 ON &mw_prefix.category (cat_title);
 178+CREATE INDEX &mw_prefix.category_i01 ON &mw_prefix.category (cat_pages);
 179+
 180+CREATE TABLE &mw_prefix.externallinks (
 181+ el_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
 182+ el_to VARCHAR2(2048) NOT NULL,
 183+ el_index VARCHAR2(2048) NOT NULL
 184+);
 185+CREATE INDEX &mw_prefix.externallinks_i01 ON &mw_prefix.externallinks (el_from, el_to);
 186+CREATE INDEX &mw_prefix.externallinks_i02 ON &mw_prefix.externallinks (el_to, el_from);
 187+CREATE INDEX &mw_prefix.externallinks_i03 ON &mw_prefix.externallinks (el_index);
 188+
 189+CREATE TABLE &mw_prefix.external_user (
 190+ eu_local_id NUMBER NOT NULL,
 191+ eu_external_id varchar2(255) NOT NULL
 192+);
 193+ALTER TABLE &mw_prefix.external_user ADD CONSTRAINT &mw_prefix.external_user_pk PRIMARY KEY (eu_local_id);
 194+CREATE UNIQUE INDEX &mw_prefix.external_user_u01 ON &mw_prefix.external_user (eu_external_id);
 195+
 196+CREATE TABLE &mw_prefix.langlinks (
 197+ ll_from NUMBER NOT NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE,
 198+ ll_lang VARCHAR2(20),
 199+ ll_title VARCHAR2(255)
 200+);
 201+CREATE UNIQUE INDEX &mw_prefix.langlinks_u01 ON &mw_prefix.langlinks (ll_from, ll_lang);
 202+CREATE INDEX &mw_prefix.langlinks_i01 ON &mw_prefix.langlinks (ll_lang, ll_title);
 203+
 204+CREATE TABLE &mw_prefix.site_stats (
 205+ ss_row_id NUMBER NOT NULL ,
 206+ ss_total_views NUMBER DEFAULT 0,
 207+ ss_total_edits NUMBER DEFAULT 0,
 208+ ss_good_articles NUMBER DEFAULT 0,
 209+ ss_total_pages NUMBER DEFAULT -1,
 210+ ss_users NUMBER DEFAULT -1,
 211+ ss_active_users NUMBER DEFAULT -1,
 212+ ss_admins NUMBER DEFAULT -1,
 213+ ss_images NUMBER DEFAULT 0
 214+);
 215+CREATE UNIQUE INDEX &mw_prefix.site_stats_u01 ON &mw_prefix.site_stats (ss_row_id);
 216+
 217+CREATE TABLE &mw_prefix.hitcounter (
 218+ hc_id NUMBER NOT NULL
 219+);
 220+
 221+CREATE SEQUENCE ipblocks_ipb_id_seq;
 222+CREATE TABLE &mw_prefix.ipblocks (
 223+ ipb_id NUMBER NOT NULL,
 224+ ipb_address VARCHAR2(255) NULL,
 225+ ipb_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 226+ ipb_by NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE,
 227+ ipb_by_text VARCHAR2(255) NOT NULL,
 228+ ipb_reason VARCHAR2(255) NOT NULL,
 229+ ipb_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
 230+ ipb_auto CHAR(1) DEFAULT '0' NOT NULL,
 231+ ipb_anon_only CHAR(1) DEFAULT '0' NOT NULL,
 232+ ipb_create_account CHAR(1) DEFAULT '1' NOT NULL,
 233+ ipb_enable_autoblock CHAR(1) DEFAULT '1' NOT NULL,
 234+ ipb_expiry TIMESTAMP(6) WITH TIME ZONE NOT NULL,
 235+ ipb_range_start VARCHAR2(255),
 236+ ipb_range_end VARCHAR2(255),
 237+ ipb_deleted CHAR(1) DEFAULT '0' NOT NULL,
 238+ ipb_block_email CHAR(1) DEFAULT '0' NOT NULL,
 239+ ipb_allow_usertalk CHAR(1) DEFAULT '0' NOT NULL
 240+);
 241+ALTER TABLE &mw_prefix.ipblocks ADD CONSTRAINT &mw_prefix.ipblocks_pk PRIMARY KEY (ipb_id);
 242+CREATE UNIQUE INDEX &mw_prefix.ipblocks_u01 ON &mw_prefix.ipblocks (ipb_address, ipb_user, ipb_auto, ipb_anon_only);
 243+CREATE INDEX &mw_prefix.ipblocks_i01 ON &mw_prefix.ipblocks (ipb_user);
 244+CREATE INDEX &mw_prefix.ipblocks_i02 ON &mw_prefix.ipblocks (ipb_range_start, ipb_range_end);
 245+CREATE INDEX &mw_prefix.ipblocks_i03 ON &mw_prefix.ipblocks (ipb_timestamp);
 246+CREATE INDEX &mw_prefix.ipblocks_i04 ON &mw_prefix.ipblocks (ipb_expiry);
 247+
 248+CREATE TABLE &mw_prefix.image (
 249+ img_name VARCHAR2(255) NOT NULL,
 250+ img_size NUMBER NOT NULL,
 251+ img_width NUMBER NOT NULL,
 252+ img_height NUMBER NOT NULL,
 253+ img_metadata CLOB,
 254+ img_bits NUMBER,
 255+ img_media_type VARCHAR2(32),
 256+ img_major_mime VARCHAR2(32) DEFAULT 'unknown',
 257+ img_minor_mime VARCHAR2(100) DEFAULT 'unknown',
 258+ img_description VARCHAR2(255),
 259+ img_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 260+ img_user_text VARCHAR2(255) NOT NULL,
 261+ img_timestamp TIMESTAMP(6) WITH TIME ZONE,
 262+ img_sha1 VARCHAR2(32)
 263+);
 264+ALTER TABLE &mw_prefix.image ADD CONSTRAINT &mw_prefix.image_pk PRIMARY KEY (img_name);
 265+CREATE INDEX &mw_prefix.image_i01 ON &mw_prefix.image (img_user_text,img_timestamp);
 266+CREATE INDEX &mw_prefix.image_i02 ON &mw_prefix.image (img_size);
 267+CREATE INDEX &mw_prefix.image_i03 ON &mw_prefix.image (img_timestamp);
 268+CREATE INDEX &mw_prefix.image_i04 ON &mw_prefix.image (img_sha1);
 269+
 270+
 271+CREATE TABLE &mw_prefix.oldimage (
 272+ oi_name VARCHAR2(255) NOT NULL REFERENCES &mw_prefix.image(img_name),
 273+ oi_archive_name VARCHAR2(255),
 274+ oi_size NUMBER NOT NULL,
 275+ oi_width NUMBER NOT NULL,
 276+ oi_height NUMBER NOT NULL,
 277+ oi_bits NUMBER NOT NULL,
 278+ oi_description VARCHAR2(255),
 279+ oi_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 280+ oi_user_text VARCHAR2(255) NOT NULL,
 281+ oi_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
 282+ oi_metadata CLOB,
 283+ oi_media_type VARCHAR2(32) DEFAULT NULL,
 284+ oi_major_mime VARCHAR2(32) DEFAULT 'unknown',
 285+ oi_minor_mime VARCHAR2(100) DEFAULT 'unknown',
 286+ oi_deleted NUMBER DEFAULT 0 NOT NULL,
 287+ oi_sha1 VARCHAR2(32)
 288+);
 289+CREATE INDEX &mw_prefix.oldimage_i01 ON &mw_prefix.oldimage (oi_user_text,oi_timestamp);
 290+CREATE INDEX &mw_prefix.oldimage_i02 ON &mw_prefix.oldimage (oi_name,oi_timestamp);
 291+CREATE INDEX &mw_prefix.oldimage_i03 ON &mw_prefix.oldimage (oi_name,oi_archive_name);
 292+CREATE INDEX &mw_prefix.oldimage_i04 ON &mw_prefix.oldimage (oi_sha1);
 293+
 294+
 295+CREATE SEQUENCE filearchive_fa_id_seq;
 296+CREATE TABLE &mw_prefix.filearchive (
 297+ fa_id NUMBER NOT NULL,
 298+ fa_name VARCHAR2(255) NOT NULL,
 299+ fa_archive_name VARCHAR2(255),
 300+ fa_storage_group VARCHAR2(16),
 301+ fa_storage_key VARCHAR2(64),
 302+ fa_deleted_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 303+ fa_deleted_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
 304+ fa_deleted_reason CLOB,
 305+ fa_size NUMBER NOT NULL,
 306+ fa_width NUMBER NOT NULL,
 307+ fa_height NUMBER NOT NULL,
 308+ fa_metadata CLOB,
 309+ fa_bits NUMBER,
 310+ fa_media_type VARCHAR2(32) DEFAULT NULL,
 311+ fa_major_mime VARCHAR2(32) DEFAULT 'unknown',
 312+ fa_minor_mime VARCHAR2(100) DEFAULT 'unknown',
 313+ fa_description VARCHAR2(255),
 314+ fa_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 315+ fa_user_text VARCHAR2(255) NOT NULL,
 316+ fa_timestamp TIMESTAMP(6) WITH TIME ZONE,
 317+ fa_deleted NUMBER DEFAULT '0' NOT NULL
 318+);
 319+ALTER TABLE &mw_prefix.filearchive ADD CONSTRAINT &mw_prefix.filearchive_pk PRIMARY KEY (fa_id);
 320+CREATE INDEX &mw_prefix.filearchive_i01 ON &mw_prefix.filearchive (fa_name, fa_timestamp);
 321+CREATE INDEX &mw_prefix.filearchive_i02 ON &mw_prefix.filearchive (fa_storage_group, fa_storage_key);
 322+CREATE INDEX &mw_prefix.filearchive_i03 ON &mw_prefix.filearchive (fa_deleted_timestamp);
 323+CREATE INDEX &mw_prefix.filearchive_i04 ON &mw_prefix.filearchive (fa_user_text,fa_timestamp);
 324+
 325+CREATE SEQUENCE recentchanges_rc_id_seq;
 326+CREATE TABLE &mw_prefix.recentchanges (
 327+ rc_id NUMBER NOT NULL,
 328+ rc_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
 329+ rc_cur_time TIMESTAMP(6) WITH TIME ZONE NOT NULL,
 330+ rc_user NUMBER NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 331+ rc_user_text VARCHAR2(255) NOT NULL,
 332+ rc_namespace NUMBER NOT NULL,
 333+ rc_title VARCHAR2(255) NOT NULL,
 334+ rc_comment VARCHAR2(255),
 335+ rc_minor CHAR(1) DEFAULT '0' NOT NULL,
 336+ rc_bot CHAR(1) DEFAULT '0' NOT NULL,
 337+ rc_new CHAR(1) DEFAULT '0' NOT NULL,
 338+ rc_cur_id NUMBER NULL REFERENCES &mw_prefix.page(page_id) ON DELETE SET NULL,
 339+ rc_this_oldid NUMBER NOT NULL,
 340+ rc_last_oldid NUMBER NOT NULL,
 341+ rc_type CHAR(1) DEFAULT '0' NOT NULL,
 342+ rc_moved_to_ns NUMBER,
 343+ rc_moved_to_title VARCHAR2(255),
 344+ rc_patrolled CHAR(1) DEFAULT '0' NOT NULL,
 345+ rc_ip VARCHAR2(15),
 346+ rc_old_len NUMBER,
 347+ rc_new_len NUMBER,
 348+ rc_deleted NUMBER DEFAULT '0' NOT NULL,
 349+ rc_logid NUMBER DEFAULT '0' NOT NULL,
 350+ rc_log_type VARCHAR2(255),
 351+ rc_log_action VARCHAR2(255),
 352+ rc_params CLOB
 353+);
 354+ALTER TABLE &mw_prefix.recentchanges ADD CONSTRAINT &mw_prefix.recentchanges_pk PRIMARY KEY (rc_id);
 355+CREATE INDEX &mw_prefix.recentchanges_i01 ON &mw_prefix.recentchanges (rc_timestamp);
 356+CREATE INDEX &mw_prefix.recentchanges_i02 ON &mw_prefix.recentchanges (rc_namespace, rc_title);
 357+CREATE INDEX &mw_prefix.recentchanges_i03 ON &mw_prefix.recentchanges (rc_cur_id);
 358+CREATE INDEX &mw_prefix.recentchanges_i04 ON &mw_prefix.recentchanges (rc_new,rc_namespace,rc_timestamp);
 359+CREATE INDEX &mw_prefix.recentchanges_i05 ON &mw_prefix.recentchanges (rc_ip);
 360+CREATE INDEX &mw_prefix.recentchanges_i06 ON &mw_prefix.recentchanges (rc_namespace, rc_user_text);
 361+CREATE INDEX &mw_prefix.recentchanges_i07 ON &mw_prefix.recentchanges (rc_user_text, rc_timestamp);
 362+
 363+CREATE TABLE &mw_prefix.watchlist (
 364+ wl_user NUMBER NOT NULL REFERENCES &mw_prefix.mwuser(user_id) ON DELETE CASCADE,
 365+ wl_namespace NUMBER DEFAULT 0 NOT NULL,
 366+ wl_title VARCHAR2(255) NOT NULL,
 367+ wl_notificationtimestamp TIMESTAMP(6) WITH TIME ZONE
 368+);
 369+CREATE UNIQUE INDEX &mw_prefix.watchlist_u01 ON &mw_prefix.watchlist (wl_user, wl_namespace, wl_title);
 370+CREATE INDEX &mw_prefix.watchlist_i01 ON &mw_prefix.watchlist (wl_namespace, wl_title);
 371+
 372+
 373+CREATE TABLE &mw_prefix.math (
 374+ math_inputhash VARCHAR2(32) NOT NULL,
 375+ math_outputhash VARCHAR2(32) NOT NULL,
 376+ math_html_conservativeness NUMBER NOT NULL,
 377+ math_html CLOB,
 378+ math_mathml CLOB
 379+);
 380+CREATE UNIQUE INDEX &mw_prefix.math_u01 ON &mw_prefix.math (math_inputhash);
 381+
 382+CREATE TABLE &mw_prefix.searchindex (
 383+ si_page NUMBER NOT NULL,
 384+ si_title VARCHAR2(255) DEFAULT '' NOT NULL,
 385+ si_text CLOB NOT NULL
 386+);
 387+CREATE UNIQUE INDEX &mw_prefix.searchindex_u01 ON &mw_prefix.searchindex (si_page);
 388+
 389+CREATE TABLE &mw_prefix.interwiki (
 390+ iw_prefix VARCHAR2(32) NOT NULL,
 391+ iw_url VARCHAR2(127) NOT NULL,
 392+ iw_local CHAR(1) NOT NULL,
 393+ iw_trans CHAR(1) DEFAULT '0' NOT NULL
 394+);
 395+CREATE UNIQUE INDEX &mw_prefix.interwiki_u01 ON &mw_prefix.interwiki (iw_prefix);
 396+
 397+CREATE TABLE &mw_prefix.querycache (
 398+ qc_type VARCHAR2(32) NOT NULL,
 399+ qc_value NUMBER NOT NULL,
 400+ qc_namespace NUMBER NOT NULL,
 401+ qc_title VARCHAR2(255) NOT NULL
 402+);
 403+CREATE INDEX &mw_prefix.querycache_u01 ON &mw_prefix.querycache (qc_type,qc_value);
 404+
 405+CREATE TABLE &mw_prefix.objectcache (
 406+ keyname VARCHAR2(255) ,
 407+ value BLOB,
 408+ exptime TIMESTAMP(6) WITH TIME ZONE NOT NULL
 409+);
 410+CREATE INDEX &mw_prefix.objectcache_i01 ON &mw_prefix.objectcache (exptime);
 411+
 412+CREATE TABLE &mw_prefix.transcache (
 413+ tc_url VARCHAR2(255) NOT NULL,
 414+ tc_contents CLOB NOT NULL,
 415+ tc_time TIMESTAMP(6) WITH TIME ZONE NOT NULL
 416+);
 417+CREATE UNIQUE INDEX &mw_prefix.transcache_u01 ON &mw_prefix.transcache (tc_url);
 418+
 419+
 420+CREATE SEQUENCE logging_log_id_seq;
 421+CREATE TABLE &mw_prefix.logging (
 422+ log_id NUMBER NOT NULL,
 423+ log_type VARCHAR2(10) NOT NULL,
 424+ log_action VARCHAR2(10) NOT NULL,
 425+ log_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
 426+ log_user NUMBER REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL,
 427+ log_user_text VARCHAR2(255),
 428+ log_namespace NUMBER NOT NULL,
 429+ log_title VARCHAR2(255) NOT NULL,
 430+ log_page NUMBER,
 431+ log_comment VARCHAR2(255),
 432+ log_params CLOB,
 433+ log_deleted NUMBER DEFAULT '0' NOT NULL
 434+);
 435+ALTER TABLE &mw_prefix.logging ADD CONSTRAINT &mw_prefix.logging_pk PRIMARY KEY (log_id);
 436+CREATE INDEX &mw_prefix.logging_i01 ON &mw_prefix.logging (log_type, log_timestamp);
 437+CREATE INDEX &mw_prefix.logging_i02 ON &mw_prefix.logging (log_user, log_timestamp);
 438+CREATE INDEX &mw_prefix.logging_i03 ON &mw_prefix.logging (log_namespace, log_title, log_timestamp);
 439+CREATE INDEX &mw_prefix.logging_i04 ON &mw_prefix.logging (log_timestamp);
 440+
 441+CREATE TABLE &mw_prefix.log_search (
 442+ ls_field VARCHAR2(32) NOT NULL,
 443+ ls_value VARCHAR2(255) NOT NULL,
 444+ ls_log_id NuMBER DEFAULT 0 NOT NULL
 445+);
 446+ALTER TABLE &mw_prefix.log_search ADD CONSTRAINT log_search_pk PRIMARY KEY (ls_field,ls_value,ls_log_id);
 447+CREATE INDEX &mw_prefix.log_search_i01 ON &mw_prefix.log_search (ls_log_id);
 448+
 449+CREATE SEQUENCE trackbacks_tb_id_seq;
 450+CREATE TABLE &mw_prefix.trackbacks (
 451+ tb_id NUMBER NOT NULL,
 452+ tb_page NUMBER REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
 453+ tb_title VARCHAR2(255) NOT NULL,
 454+ tb_url VARCHAR2(255) NOT NULL,
 455+ tb_ex CLOB,
 456+ tb_name VARCHAR2(255)
 457+);
 458+ALTER TABLE &mw_prefix.trackbacks ADD CONSTRAINT &mw_prefix.trackbacks_pk PRIMARY KEY (tb_id);
 459+CREATE INDEX &mw_prefix.trackbacks_i01 ON &mw_prefix.trackbacks (tb_page);
 460+
 461+CREATE SEQUENCE job_job_id_seq;
 462+CREATE TABLE &mw_prefix.job (
 463+ job_id NUMBER NOT NULL,
 464+ job_cmd VARCHAR2(60) NOT NULL,
 465+ job_namespace NUMBER NOT NULL,
 466+ job_title VARCHAR2(255) NOT NULL,
 467+ job_params CLOB NOT NULL
 468+);
 469+ALTER TABLE &mw_prefix.job ADD CONSTRAINT &mw_prefix.job_pk PRIMARY KEY (job_id);
 470+CREATE INDEX &mw_prefix.job_i01 ON &mw_prefix.job (job_cmd, job_namespace, job_title);
 471+
 472+CREATE TABLE &mw_prefix.querycache_info (
 473+ qci_type VARCHAR2(32) NOT NULL,
 474+ qci_timestamp TIMESTAMP(6) WITH TIME ZONE NULL
 475+);
 476+CREATE UNIQUE INDEX &mw_prefix.querycache_info_u01 ON &mw_prefix.querycache_info (qci_type);
 477+
 478+CREATE TABLE &mw_prefix.redirect (
 479+ rd_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
 480+ rd_namespace NUMBER NOT NULL,
 481+ rd_title VARCHAR2(255) NOT NULL,
 482+ rd_interwiki VARCHAR2(32),
 483+ rd_fragment VARCHAR2(255)
 484+);
 485+CREATE INDEX &mw_prefix.redirect_i01 ON &mw_prefix.redirect (rd_namespace,rd_title,rd_from);
 486+
 487+CREATE TABLE &mw_prefix.querycachetwo (
 488+ qcc_type VARCHAR2(32) NOT NULL,
 489+ qcc_value NUMBER DEFAULT 0 NOT NULL,
 490+ qcc_namespace NUMBER DEFAULT 0 NOT NULL,
 491+ qcc_title VARCHAR2(255) DEFAULT '' NOT NULL,
 492+ qcc_namespacetwo NUMBER DEFAULT 0 NOT NULL,
 493+ qcc_titletwo VARCHAR2(255) DEFAULT '' NOT NULL
 494+);
 495+CREATE INDEX &mw_prefix.querycachetwo_i01 ON &mw_prefix.querycachetwo (qcc_type,qcc_value);
 496+CREATE INDEX &mw_prefix.querycachetwo_i02 ON &mw_prefix.querycachetwo (qcc_type,qcc_namespace,qcc_title);
 497+CREATE INDEX &mw_prefix.querycachetwo_i03 ON &mw_prefix.querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo);
 498+
 499+CREATE SEQUENCE page_restrictions_pr_id_seq;
 500+CREATE TABLE &mw_prefix.page_restrictions (
 501+ pr_id NUMBER NOT NULL,
 502+ pr_page NUMBER NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE,
 503+ pr_type VARCHAR2(255) NOT NULL,
 504+ pr_level VARCHAR2(255) NOT NULL,
 505+ pr_cascade NUMBER NOT NULL,
 506+ pr_user NUMBER NULL,
 507+ pr_expiry TIMESTAMP(6) WITH TIME ZONE NULL
 508+);
 509+ALTER TABLE &mw_prefix.page_restrictions ADD CONSTRAINT &mw_prefix.page_restrictions_pk PRIMARY KEY (pr_page,pr_type);
 510+CREATE INDEX &mw_prefix.page_restrictions_i01 ON &mw_prefix.page_restrictions (pr_type,pr_level);
 511+CREATE INDEX &mw_prefix.page_restrictions_i02 ON &mw_prefix.page_restrictions (pr_level);
 512+CREATE INDEX &mw_prefix.page_restrictions_i03 ON &mw_prefix.page_restrictions (pr_cascade);
 513+
 514+CREATE TABLE &mw_prefix.protected_titles (
 515+ pt_namespace NUMBER NOT NULL,
 516+ pt_title VARCHAR2(255) NOT NULL,
 517+ pt_user NUMBER NOT NULL,
 518+ pt_reason VARCHAR2(255),
 519+ pt_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
 520+ pt_expiry VARCHAR2(14) NOT NULL,
 521+ pt_create_perm VARCHAR2(60) NOT NULL
 522+);
 523+CREATE UNIQUE INDEX &mw_prefix.protected_titles_u01 ON &mw_prefix.protected_titles (pt_namespace,pt_title);
 524+CREATE INDEX &mw_prefix.protected_titles_i01 ON &mw_prefix.protected_titles (pt_timestamp);
 525+
 526+CREATE TABLE &mw_prefix.page_props (
 527+ pp_page NUMBER NOT NULL,
 528+ pp_propname VARCHAR2(60) NOT NULL,
 529+ pp_value BLOB NOT NULL
 530+);
 531+CREATE UNIQUE INDEX &mw_prefix.page_props_u01 ON &mw_prefix.page_props (pp_page,pp_propname);
 532+
 533+
 534+CREATE TABLE &mw_prefix.updatelog (
 535+ ul_key VARCHAR2(255) NOT NULL
 536+);
 537+ALTER TABLE &mw_prefix.updatelog ADD CONSTRAINT &mw_prefix.updatelog_pk PRIMARY KEY (ul_key);
 538+
 539+CREATE TABLE &mw_prefix.change_tag (
 540+ ct_rc_id NUMBER NULL,
 541+ ct_log_id NUMBER NULL,
 542+ ct_rev_id NUMBER NULL,
 543+ ct_tag VARCHAR2(255) NOT NULL,
 544+ ct_params BLOB NULL
 545+);
 546+CREATE UNIQUE INDEX &mw_prefix.change_tag_u01 ON &mw_prefix.change_tag (ct_rc_id,ct_tag);
 547+CREATE UNIQUE INDEX &mw_prefix.change_tag_u02 ON &mw_prefix.change_tag (ct_log_id,ct_tag);
 548+CREATE UNIQUE INDEX &mw_prefix.change_tag_u03 ON &mw_prefix.change_tag (ct_rev_id,ct_tag);
 549+CREATE INDEX &mw_prefix.change_tag_i01 ON &mw_prefix.change_tag (ct_tag,ct_rc_id,ct_rev_id,ct_log_id);
 550+
 551+CREATE TABLE &mw_prefix.tag_summary (
 552+ ts_rc_id NUMBER NULL,
 553+ ts_log_id NUMBER NULL,
 554+ ts_rev_id NUMBER NULL,
 555+ ts_tags BLOB NOT NULL
 556+);
 557+CREATE UNIQUE INDEX &mw_prefix.tag_summary_u01 ON &mw_prefix.tag_summary (ts_rc_id);
 558+CREATE UNIQUE INDEX &mw_prefix.tag_summary_u02 ON &mw_prefix.tag_summary (ts_log_id);
 559+CREATE UNIQUE INDEX &mw_prefix.tag_summary_u03 ON &mw_prefix.tag_summary (ts_rev_id);
 560+
 561+CREATE TABLE &mw_prefix.valid_tag (
 562+ vt_tag VARCHAR2(255) NOT NULL
 563+);
 564+ALTER TABLE &mw_prefix.valid_tag ADD CONSTRAINT &mw_prefix.valid_tag_pk PRIMARY KEY (vt_tag);
 565+
 566+-- This table is not used unless profiling is turned on
 567+--CREATE TABLE &mw_prefix.profiling (
 568+-- pf_count NUMBER DEFAULT 0 NOT NULL,
 569+-- pf_time NUMERIC(18,10) DEFAULT 0 NOT NULL,
 570+-- pf_name CLOB NOT NULL,
 571+-- pf_server CLOB NULL
 572+--);
 573+--CREATE UNIQUE INDEX &mw_prefix.profiling_u01 ON &mw_prefix.profiling (pf_name, pf_server);
 574+
 575+CREATE INDEX si_title_idx ON &mw_prefix.searchindex(si_title) INDEXTYPE IS ctxsys.context;
 576+CREATE INDEX si_text_idx ON &mw_prefix.searchindex(si_text) INDEXTYPE IS ctxsys.context;
 577+
 578+CREATE TABLE &mw_prefix.l10n_cache (
 579+ lc_lang varchar2(32) NOT NULL,
 580+ lc_key varchar2(255) NOT NULL,
 581+ lc_value clob NOT NULL
 582+);
 583+CREATE INDEX &mw_prefix.l10n_cache_u01 ON &mw_prefix.l10n_cache (lc_lang, lc_key);
 584+
 585+-- do not prefix this table as it breaks parserTests
 586+CREATE TABLE wiki_field_info_full (
 587+table_name VARCHAR2(35) NOT NULL,
 588+column_name VARCHAR2(35) NOT NULL,
 589+data_default VARCHAR2(4000),
 590+data_length NUMBER NOT NULL,
 591+data_type VARCHAR2(106),
 592+not_null CHAR(1) NOT NULL,
 593+prim NUMBER(1),
 594+uniq NUMBER(1),
 595+nonuniq NUMBER(1)
 596+);
 597+ALTER TABLE wiki_field_info_full ADD CONSTRAINT wiki_field_info_full_pk PRIMARY KEY (table_name, column_name);
 598+
 599+/*$mw$*/
 600+CREATE PROCEDURE fill_wiki_info IS
 601+ BEGIN
 602+ DELETE wiki_field_info_full;
 603+
 604+ FOR x_rec IN (SELECT t.table_name table_name, t.column_name,
 605+ t.data_default, t.data_length, t.data_type,
 606+ DECODE (t.nullable, 'Y', '1', 'N', '0') not_null,
 607+ (SELECT 1
 608+ FROM user_cons_columns ucc,
 609+ user_constraints uc
 610+ WHERE ucc.table_name = t.table_name
 611+ AND ucc.column_name = t.column_name
 612+ AND uc.constraint_name = ucc.constraint_name
 613+ AND uc.constraint_type = 'P'
 614+ AND ROWNUM < 2) prim,
 615+ (SELECT 1
 616+ FROM user_ind_columns uic,
 617+ user_indexes ui
 618+ WHERE uic.table_name = t.table_name
 619+ AND uic.column_name = t.column_name
 620+ AND ui.index_name = uic.index_name
 621+ AND ui.uniqueness = 'UNIQUE'
 622+ AND ROWNUM < 2) uniq,
 623+ (SELECT 1
 624+ FROM user_ind_columns uic,
 625+ user_indexes ui
 626+ WHERE uic.table_name = t.table_name
 627+ AND uic.column_name = t.column_name
 628+ AND ui.index_name = uic.index_name
 629+ AND ui.uniqueness = 'NONUNIQUE'
 630+ AND ROWNUM < 2) nonuniq
 631+ FROM user_tab_columns t, user_tables ut
 632+ WHERE ut.table_name = t.table_name)
 633+ LOOP
 634+ INSERT INTO wiki_field_info_full
 635+ (table_name, column_name,
 636+ data_default, data_length,
 637+ data_type, not_null, prim,
 638+ uniq, nonuniq
 639+ )
 640+ VALUES (x_rec.table_name, x_rec.column_name,
 641+ x_rec.data_default, x_rec.data_length,
 642+ x_rec.data_type, x_rec.not_null, x_rec.prim,
 643+ x_rec.uniq, x_rec.nonuniq
 644+ );
 645+ END LOOP;
 646+ COMMIT;
 647+END;
 648+/*$mw$*/
 649+
 650+/*$mw$*/
 651+CREATE OR REPLACE PROCEDURE duplicate_table(p_tabname IN VARCHAR2,
 652+ p_oldprefix IN VARCHAR2,
 653+ p_newprefix IN VARCHAR2,
 654+ p_temporary IN BOOLEAN) IS
 655+ e_table_not_exist EXCEPTION;
 656+ PRAGMA EXCEPTION_INIT(e_table_not_exist, -00942);
 657+BEGIN
 658+ BEGIN
 659+ EXECUTE IMMEDIATE 'DROP TABLE ' || p_newprefix || p_tabname ||
 660+ ' CASCADE CONSTRAINTS';
 661+ EXCEPTION
 662+ WHEN e_table_not_exist THEN
 663+ NULL;
 664+ END;
 665+ IF (p_temporary) THEN
 666+ EXECUTE IMMEDIATE 'CREATE GLOBAL TEMPORARY TABLE ' || p_newprefix ||
 667+ p_tabname || ' AS SELECT * FROM ' || p_oldprefix ||
 668+ p_tabname || ' WHERE ROWNUM = 0';
 669+ ELSE
 670+ EXECUTE IMMEDIATE 'CREATE TABLE ' || p_newprefix || p_tabname ||
 671+ ' AS SELECT * FROM ' || p_oldprefix || p_tabname ||
 672+ ' WHERE ROWNUM = 0';
 673+ END IF;
 674+ FOR rc IN (SELECT column_name, data_default
 675+ FROM user_tab_columns
 676+ WHERE table_name = p_oldprefix || p_tabname
 677+ AND data_default IS NOT NULL) LOOP
 678+ EXECUTE IMMEDIATE 'ALTER TABLE ' || p_newprefix || p_tabname ||
 679+ ' MODIFY ' || rc.column_name || ' DEFAULT ' ||
 680+ substr(rc.data_default, 1, 2000);
 681+ END LOOP;
 682+ FOR rc IN (SELECT REPLACE(REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('CONSTRAINT',
 683+ constraint_name),
 684+ 32767,
 685+ 1),
 686+ USER || '"."' || p_oldprefix,
 687+ USER || '"."' || p_newprefix),
 688+ '"' || constraint_name || '"',
 689+ '"' || p_newprefix || constraint_name || '"') DDLVC2,
 690+ constraint_name
 691+ FROM user_constraints uc
 692+ WHERE table_name = p_oldprefix || p_tabname
 693+ AND constraint_type = 'P') LOOP
 694+ dbms_output.put_line(SUBSTR(rc.ddlvc2,
 695+ 1,
 696+ INSTR(rc.ddlvc2, 'PCTFREE') - 1));
 697+ EXECUTE IMMEDIATE SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1);
 698+ END LOOP;
 699+ FOR rc IN (SELECT REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('REF_CONSTRAINT',
 700+ constraint_name),
 701+ 32767,
 702+ 1),
 703+ USER || '"."' || p_oldprefix,
 704+ USER || '"."' || p_newprefix) DDLVC2,
 705+ constraint_name
 706+ FROM user_constraints uc
 707+ WHERE table_name = p_oldprefix || p_tabname
 708+ AND constraint_type = 'R') LOOP
 709+ EXECUTE IMMEDIATE rc.ddlvc2;
 710+ END LOOP;
 711+ FOR rc IN (SELECT REPLACE(REPLACE(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('INDEX',
 712+ index_name),
 713+ 32767,
 714+ 1),
 715+ USER || '"."' || p_oldprefix,
 716+ USER || '"."' || p_newprefix),
 717+ '"' || index_name || '"',
 718+ '"' || p_newprefix || index_name || '"') DDLVC2,
 719+ index_name
 720+ FROM user_indexes ui
 721+ WHERE table_name = p_oldprefix || p_tabname
 722+ AND index_type != 'LOB'
 723+ AND NOT EXISTS
 724+ (SELECT NULL
 725+ FROM user_constraints
 726+ WHERE table_name = ui.table_name
 727+ AND constraint_name = ui.index_name)) LOOP
 728+ EXECUTE IMMEDIATE SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'PCTFREE') - 1);
 729+ END LOOP;
 730+ FOR rc IN (SELECT REPLACE(REPLACE(UPPER(DBMS_LOB.SUBSTR(DBMS_METADATA.get_ddl('TRIGGER',
 731+ trigger_name),
 732+ 32767,
 733+ 1)),
 734+ USER || '"."' || p_oldprefix,
 735+ USER || '"."' || p_newprefix),
 736+ ' ON ' || p_oldprefix || p_tabname,
 737+ ' ON ' || p_newprefix || p_tabname) DDLVC2,
 738+ trigger_name
 739+ FROM user_triggers
 740+ WHERE table_name = p_oldprefix || p_tabname) LOOP
 741+ EXECUTE IMMEDIATE SUBSTR(rc.ddlvc2, 1, INSTR(rc.ddlvc2, 'ALTER ') - 1);
 742+ END LOOP;
 743+END;
 744+/*$mw$*/
 745+
 746+/*$mw$*/
 747+BEGIN
 748+ fill_wiki_info;
 749+END;
 750+/*$mw$*/
 751+
 752+/*$mw$*/
 753+CREATE OR REPLACE FUNCTION BITOR (x IN NUMBER, y IN NUMBER) RETURN NUMBER AS
 754+BEGIN
 755+ RETURN (x + y - BITAND(x, y));
 756+END;
 757+/*$mw$*/
 758+
 759+/*$mw$*/
 760+CREATE OR REPLACE FUNCTION BITNOT (x IN NUMBER) RETURN NUMBER AS
 761+BEGIN
 762+ RETURN (4294967295 - x);
 763+END;
 764+/*$mw$*/
 765+
 766+/*$mw$*/
 767+CREATE OR REPLACE TYPE GET_OUTPUT_TYPE IS TABLE OF VARCHAR2(255);
 768+/*$mw$*/
 769+
 770+/*$mw$*/
 771+CREATE OR REPLACE FUNCTION GET_OUTPUT_LINES RETURN GET_OUTPUT_TYPE PIPELINED AS
 772+ v_line VARCHAR2(255);
 773+ v_status INTEGER := 0;
 774+BEGIN
 775+
 776+ LOOP
 777+ DBMS_OUTPUT.GET_LINE(v_line, v_status);
 778+ IF (v_status = 0) THEN RETURN; END IF;
 779+ PIPE ROW (v_line);
 780+ END LOOP;
 781+ RETURN;
 782+EXCEPTION
 783+ WHEN OTHERS THEN
 784+ RETURN;
 785+END;
 786+/*$mw$*/
 787+
 788+/*$mw$*/
 789+CREATE OR REPLACE FUNCTION GET_SEQUENCE_VALUE(seq IN VARCHAR2) RETURN NUMBER AS
 790+ v_value NUMBER;
 791+BEGIN
 792+ EXECUTE IMMEDIATE 'SELECT '||seq||'.NEXTVAL INTO :outVar FROM DUAL' INTO v_value;
 793+ RETURN v_value;
 794+END;
 795+/*$mw$*/
Property changes on: trunk/phase3/maintenance/oracle/tables.sql
___________________________________________________________________
Added: svn:eol-style
1796 + native
Index: trunk/phase3/maintenance/oracle/user.sql
@@ -0,0 +1,16 @@
 2+-- defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}';
 3+define wiki_user='{$wgDBuser}';
 4+define wiki_pass='{$wgDBpassword}';
 5+define def_ts='{$wgDBOracleDefTS}';
 6+define temp_ts='{$wgDBOracleTempTS}';
 7+
 8+create user &wiki_user. identified by &wiki_pass. default tablespace &def_ts. temporary tablespace &temp_ts. quota unlimited on &def_ts.;
 9+grant connect, resource to &wiki_user.;
 10+grant alter session to &wiki_user.;
 11+grant ctxapp to &wiki_user.;
 12+grant execute on ctx_ddl to &wiki_user.;
 13+grant create view to &wiki_user.;
 14+grant create synonym to &wiki_user.;
 15+grant create table to &wiki_user.;
 16+grant create sequence to &wiki_user.;
 17+grant create trigger to &wiki_user.;
Property changes on: trunk/phase3/maintenance/oracle/user.sql
___________________________________________________________________
Added: svn:eol-style
118 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r72536Followup r72535, I suppose I shouldn't break the old installer yetdemon12:48, 7 September 2010

Status & tagging log