r101976 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101975‎ | r101976 | r101977 >
Date:11:35, 4 November 2011
Author:freakolowsky
Status:ok
Tags:
Comment:
* fixed ipblocks.ipb_by_text field, removed default blank not null (fixed install&update)
* fixed Block->insert; ipblocks.ipb_id is autoincrement field (should use sequences for compatibility)
Modified paths:
  • /trunk/phase3/includes/Block.php (modified) (history)
  • /trunk/phase3/includes/installer/OracleUpdater.php (modified) (history)
  • /trunk/phase3/maintenance/oracle/archives/patch_remove_not_null_empty_defs2.sql (added) (history)
  • /trunk/phase3/maintenance/oracle/tables.sql (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/oracle/tables.sql
@@ -259,7 +259,7 @@
260260 ipb_address VARCHAR2(255) NULL,
261261 ipb_user NUMBER DEFAULT 0 NOT NULL,
262262 ipb_by NUMBER DEFAULT 0 NOT NULL,
263 - ipb_by_text VARCHAR2(255) NOT NULL,
 263+ ipb_by_text VARCHAR2(255) NULL,
264264 ipb_reason VARCHAR2(255) NOT NULL,
265265 ipb_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
266266 ipb_auto CHAR(1) DEFAULT '0' NOT NULL,
Index: trunk/phase3/maintenance/oracle/archives/patch_remove_not_null_empty_defs2.sql
@@ -0,0 +1,3 @@
 2+define mw_prefix='{$wgDBprefix}';
 3+
 4+ALTER TABLE &mw_prefix.ipblocks MODIFY ipb_by_text DEFAULT NULL NULL;
Property changes on: trunk/phase3/maintenance/oracle/archives/patch_remove_not_null_empty_defs2.sql
___________________________________________________________________
Added: svn:eol-style
15 + native
Index: trunk/phase3/includes/installer/OracleUpdater.php
@@ -46,6 +46,7 @@
4747 array( 'addTable', 'globalinterwiki', 'patch-globalinterwiki.sql' ),
4848 array( 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1_field.sql' ),
4949 array( 'addField', 'archive', 'ar_sha1', 'patch-ar_sha1_field.sql' ),
 50+ array( 'doRemoveNotNullEmptyDefaults2' ),
5051
5152 // till 2.0 i guess
5253 array( 'doRebuildDuplicateFunction' ),
@@ -145,6 +146,16 @@
146147 $this->applyPatch( 'patch_remove_not_null_empty_defs.sql', false );
147148 $this->output( "ok\n" );
148149 }
 150+ protected function doRemoveNotNullEmptyDefaults2() {
 151+ $this->output( "Removing not null empty constraints ... " );
 152+ $meta = $this->db->fieldInfo( 'ipblocks' , 'ipb_by_text' );
 153+ if ( $meta->isNullable() ) {
 154+ $this->output( "constraints seem to be removed\n" );
 155+ return;
 156+ }
 157+ $this->applyPatch( 'patch_remove_not_null_empty_defs2.sql', false );
 158+ $this->output( "ok\n" );
 159+ }
149160
150161 /**
151162 * rebuilding of the function that duplicates tables for tests
Index: trunk/phase3/includes/Block.php
@@ -426,9 +426,12 @@
427427 # Don't collide with expired blocks
428428 Block::purgeExpired();
429429
 430+ $row = $this->getDatabaseArray();
 431+ $row['ipb_id'] = $dbw->nextSequenceValue("ipblocks_ipb_id_seq");
 432+
430433 $dbw->insert(
431434 'ipblocks',
432 - $this->getDatabaseArray(),
 435+ $row,
433436 __METHOD__,
434437 array( 'IGNORE' )
435438 );

Status & tagging log