* 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)
This commit is contained in:
Jure Kajzer 2011-11-04 11:35:10 +00:00
parent 13c8aee478
commit d9b00fc155
4 changed files with 19 additions and 2 deletions

View file

@ -426,9 +426,12 @@ class Block {
# Don't collide with expired blocks
Block::purgeExpired();
$row = $this->getDatabaseArray();
$row['ipb_id'] = $dbw->nextSequenceValue("ipblocks_ipb_id_seq");
$dbw->insert(
'ipblocks',
$this->getDatabaseArray(),
$row,
__METHOD__,
array( 'IGNORE' )
);

View file

@ -46,6 +46,7 @@ class OracleUpdater extends DatabaseUpdater {
array( 'addTable', 'globalinterwiki', 'patch-globalinterwiki.sql' ),
array( 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1_field.sql' ),
array( 'addField', 'archive', 'ar_sha1', 'patch-ar_sha1_field.sql' ),
array( 'doRemoveNotNullEmptyDefaults2' ),
// till 2.0 i guess
array( 'doRebuildDuplicateFunction' ),
@ -145,6 +146,16 @@ class OracleUpdater extends DatabaseUpdater {
$this->applyPatch( 'patch_remove_not_null_empty_defs.sql', false );
$this->output( "ok\n" );
}
protected function doRemoveNotNullEmptyDefaults2() {
$this->output( "Removing not null empty constraints ... " );
$meta = $this->db->fieldInfo( 'ipblocks' , 'ipb_by_text' );
if ( $meta->isNullable() ) {
$this->output( "constraints seem to be removed\n" );
return;
}
$this->applyPatch( 'patch_remove_not_null_empty_defs2.sql', false );
$this->output( "ok\n" );
}
/**
* rebuilding of the function that duplicates tables for tests

View file

@ -0,0 +1,3 @@
define mw_prefix='{$wgDBprefix}';
ALTER TABLE &mw_prefix.ipblocks MODIFY ipb_by_text DEFAULT NULL NULL;

View file

@ -259,7 +259,7 @@ CREATE TABLE &mw_prefix.ipblocks (
ipb_address VARCHAR2(255) NULL,
ipb_user NUMBER DEFAULT 0 NOT NULL,
ipb_by NUMBER DEFAULT 0 NOT NULL,
ipb_by_text VARCHAR2(255) NOT NULL,
ipb_by_text VARCHAR2(255) NULL,
ipb_reason VARCHAR2(255) NOT NULL,
ipb_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
ipb_auto CHAR(1) DEFAULT '0' NOT NULL,