* fixed ipblocks.ipb_by_text field, removed default blank not null (fixed install...
authorJure Kajzer <freakolowsky@users.mediawiki.org>
Fri, 4 Nov 2011 11:35:10 +0000 (11:35 +0000)
committerJure Kajzer <freakolowsky@users.mediawiki.org>
Fri, 4 Nov 2011 11:35:10 +0000 (11:35 +0000)
* fixed Block->insert; ipblocks.ipb_id is autoincrement field (should use sequences for compatibility)

includes/Block.php
includes/installer/OracleUpdater.php
maintenance/oracle/archives/patch_remove_not_null_empty_defs2.sql [new file with mode: 0644]
maintenance/oracle/tables.sql

index 3a2fa6e..7aa1bc1 100644 (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' )
                );
index 82031ad..64188cb 100644 (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
diff --git a/maintenance/oracle/archives/patch_remove_not_null_empty_defs2.sql b/maintenance/oracle/archives/patch_remove_not_null_empty_defs2.sql
new file mode 100644 (file)
index 0000000..f7a38a0
--- /dev/null
@@ -0,0 +1,3 @@
+define mw_prefix='{$wgDBprefix}';
+
+ALTER TABLE &mw_prefix.ipblocks MODIFY ipb_by_text DEFAULT NULL NULL;
index c9fc05f..02488cd 100644 (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,