r58262 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58261‎ | r58262 | r58263 >
Date:16:17, 28 October 2009
Author:freakolowsky
Status:ok
Tags:
Comment:
Changed sequence names to a standard <table>_<field>_seq form.
Updated all nextSequenceValue calls with new sequence names.
OverlordQ stated he'll handle changes to Postgres scripts.
Need someone to change DB2 scripts.
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Block.php (modified) (history)
  • /trunk/phase3/includes/Category.php (modified) (history)
  • /trunk/phase3/includes/Import.php (modified) (history)
  • /trunk/phase3/includes/LogPage.php (modified) (history)
  • /trunk/phase3/includes/RecentChange.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/maintenance/ora/patch_seq_names_pre1.16.sql (added) (history)
  • /trunk/phase3/maintenance/ora/tables.sql (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Category.php
@@ -246,7 +246,7 @@
247247 } else {
248248 # Let's be sure that the row exists in the table. We don't need to
249249 # do this if we got the row from the table in initialization!
250 - $seqVal = $dbw->nextSequenceValue( 'category_id_seq' );
 250+ $seqVal = $dbw->nextSequenceValue( 'category_cat_id_seq' );
251251 $dbw->insert(
252252 'category',
253253 array( 'cat_id' => $seqVal,
Index: trunk/phase3/includes/Block.php
@@ -377,7 +377,7 @@
378378 # Don't collide with expired blocks
379379 Block::purgeExpired();
380380
381 - $ipb_id = $dbw->nextSequenceValue('ipblocks_ipb_id_val');
 381+ $ipb_id = $dbw->nextSequenceValue('ipblocks_ipb_id_seq');
382382 $dbw->insert( 'ipblocks',
383383 array(
384384 'ipb_id' => $ipb_id,
Index: trunk/phase3/includes/RecentChange.php
@@ -156,7 +156,7 @@
157157 # Fixup database timestamps
158158 $this->mAttribs['rc_timestamp'] = $dbw->timestamp($this->mAttribs['rc_timestamp']);
159159 $this->mAttribs['rc_cur_time'] = $dbw->timestamp($this->mAttribs['rc_cur_time']);
160 - $this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 'rc_rc_id_seq' );
 160+ $this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 'recentchanges_rc_id_seq' );
161161
162162 ## If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
163163 if( $dbw->cascadingDeletes() and $this->mAttribs['rc_cur_id']==0 ) {
Index: trunk/phase3/includes/Import.php
@@ -265,7 +265,7 @@
266266 $this->timestamp . "\n" );
267267 return false;
268268 }
269 - $log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
 269+ $log_id = $dbw->nextSequenceValue( 'logging_log_id_seq' );
270270 $data = array(
271271 'log_id' => $log_id,
272272 'log_type' => $this->type,
Index: trunk/phase3/includes/Revision.php
@@ -826,7 +826,7 @@
827827
828828 # Record the text (or external storage URL) to the text table
829829 if( !isset( $this->mTextId ) ) {
830 - $old_id = $dbw->nextSequenceValue( 'text_old_id_val' );
 830+ $old_id = $dbw->nextSequenceValue( 'text_old_id_seq' );
831831 $dbw->insert( 'text',
832832 array(
833833 'old_id' => $old_id,
@@ -840,7 +840,7 @@
841841 # Record the edit in revisions
842842 $rev_id = isset( $this->mId )
843843 ? $this->mId
844 - : $dbw->nextSequenceValue( 'rev_rev_id_val' );
 844+ : $dbw->nextSequenceValue( 'revision_rev_id_seq' );
845845 $dbw->insert( 'revision',
846846 array(
847847 'rev_id' => $rev_id,
Index: trunk/phase3/includes/LogPage.php
@@ -60,7 +60,7 @@
6161 global $wgLogRestrictions;
6262
6363 $dbw = wfGetDB( DB_MASTER );
64 - $log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
 64+ $log_id = $dbw->nextSequenceValue( 'logging_log_id_seq' );
6565
6666 $this->timestamp = $now = wfTimestampNow();
6767 $data = array(
Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -512,6 +512,12 @@
513513 } else {
514514 $srcTable = $this->tableName( $srcTable );
515515 }
 516+
 517+ // count-alias subselect fields to avoid abigious definition errors
 518+ $i=0;
 519+ foreach($varMap as $key=>&$val)
 520+ $val=$val.' field'.($i++);
 521+
516522 $sql = "INSERT INTO $destTable (" . implode( ',', array_keys( $varMap ) ) . ')' .
517523 " SELECT $startOpts " . implode( ',', $varMap ) .
518524 " FROM $srcTable $useIndex ";
Index: trunk/phase3/includes/Article.php
@@ -4097,7 +4097,7 @@
40984098 }
40994099 $insertRows = array();
41004100 foreach( $insertCats as $cat ) {
4101 - $insertRows[] = array( 'cat_id' => $dbw->nextSequenceValue( 'category_id_seq' ),
 4101+ $insertRows[] = array( 'cat_id' => $dbw->nextSequenceValue( 'category_cat_id_seq' ),
41024102 'cat_title' => $cat );
41034103 }
41044104 $dbw->insert( 'category', $insertRows, __METHOD__, 'IGNORE' );
Index: trunk/phase3/maintenance/ora/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
Index: trunk/phase3/maintenance/ora/tables.sql
@@ -79,7 +79,7 @@
8080 END;
8181 /*$mw$*/
8282
83 -CREATE SEQUENCE rev_rev_id_val;
 83+CREATE SEQUENCE revision_rev_id_seq;
8484 CREATE TABLE &mw_prefix.revision (
8585 rev_id NUMBER NOT NULL,
8686 rev_page NUMBER NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE,
@@ -100,7 +100,7 @@
101101 CREATE INDEX &mw_prefix.revision_i03 ON &mw_prefix.revision (rev_user,rev_timestamp);
102102 CREATE INDEX &mw_prefix.revision_i04 ON &mw_prefix.revision (rev_user_text,rev_timestamp);
103103
104 -CREATE SEQUENCE text_old_id_val;
 104+CREATE SEQUENCE text_old_id_seq;
105105 CREATE TABLE &mw_prefix.pagecontent ( -- replaces reserved word 'text'
106106 old_id NUMBER NOT NULL,
107107 old_text CLOB,
@@ -163,7 +163,7 @@
164164 CREATE INDEX &mw_prefix.categorylinks_i01 ON &mw_prefix.categorylinks (cl_to,cl_sortkey,cl_from);
165165 CREATE INDEX &mw_prefix.categorylinks_i02 ON &mw_prefix.categorylinks (cl_to,cl_timestamp);
166166
167 -CREATE SEQUENCE category_id_seq;
 167+CREATE SEQUENCE category_cat_id_seq;
168168 CREATE TABLE &mw_prefix.category (
169169 cat_id NUMBER NOT NULL,
170170 cat_title VARCHAR2(255) NOT NULL,
@@ -210,7 +210,7 @@
211211 hc_id NUMBER NOT NULL
212212 );
213213
214 -CREATE SEQUENCE ipblocks_ipb_id_val;
 214+CREATE SEQUENCE ipblocks_ipb_id_seq;
215215 CREATE TABLE &mw_prefix.ipblocks (
216216 ipb_id NUMBER NOT NULL,
217217 ipb_address VARCHAR2(255) NULL,
@@ -314,7 +314,7 @@
315315 CREATE INDEX &mw_prefix.filearchive_i03 ON &mw_prefix.filearchive (fa_deleted_timestamp);
316316 CREATE INDEX &mw_prefix.filearchive_i04 ON &mw_prefix.filearchive (fa_user_text,fa_timestamp);
317317
318 -CREATE SEQUENCE rc_rc_id_seq;
 318+CREATE SEQUENCE recentchanges_rc_id_seq;
319319 CREATE TABLE &mw_prefix.recentchanges (
320320 rc_id NUMBER NOT NULL,
321321 rc_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
@@ -409,7 +409,7 @@
410410 CREATE UNIQUE INDEX &mw_prefix.transcache_u01 ON &mw_prefix.transcache (tc_url);
411411
412412
413 -CREATE SEQUENCE log_log_id_seq;
 413+CREATE SEQUENCE logging_log_id_seq;
414414 CREATE TABLE &mw_prefix.logging (
415415 log_id NUMBER NOT NULL,
416416 log_type VARCHAR2(10) NOT NULL,
@@ -488,7 +488,7 @@
489489 CREATE INDEX &mw_prefix.querycachetwo_i02 ON &mw_prefix.querycachetwo (qcc_type,qcc_namespace,qcc_title);
490490 CREATE INDEX &mw_prefix.querycachetwo_i03 ON &mw_prefix.querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo);
491491
492 -CREATE SEQUENCE pr_id_val;
 492+CREATE SEQUENCE page_restrictions_pr_id_seq;
493493 CREATE TABLE &mw_prefix.page_restrictions (
494494 pr_id NUMBER NOT NULL,
495495 pr_page NUMBER NULL REFERENCES &mw_prefix.page (page_id) ON DELETE CASCADE,

Follow-up revisions

RevisionCommit summaryAuthorDate
r58263Followup to r58262: PG half of sequence changesoverlordq17:08, 28 October 2009

Status & tagging log