Add sequence support for externallinks table
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 3 Jan 2014 19:36:20 +0000 (20:36 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 3 Jan 2014 19:36:20 +0000 (20:36 +0100)
Database field el_id was added with
Ib6b0fc3736d173fa4ba7b786ecfc710b2f4711bb, but due to autoincrement in
mysql no sequence support was added.

For mysql this is a nop, it adds a field to the insert but that is null
and mysql autoincrement will fill it.
INSERT /* LinksUpdate::incrTableUpdate 127.0.0.1 */ IGNORE
  INTO `externallinks` (el_id,el_from,el_to,el_index)
VALUES
(NULL,'1610','http://de.wikipedia.org/wiki/Hauptseite','http://org.wikipedia.de./wiki/Hauptseite')

At least Oracle will need it

Bug: 58435
Change-Id: I3f68ea8d99c5450c0c66feeb1469ef0ee6cc4eab

includes/deferred/LinksUpdate.php
maintenance/fixExtLinksProtocolRelative.php

index d5ed250..6e0cebf 100644 (file)
@@ -414,6 +414,7 @@ class LinksUpdate extends SqlDataUpdate {
                foreach ( $diffs as $url => $dummy ) {
                        foreach ( wfMakeUrlIndexes( $url ) as $index ) {
                                $arr[] = array(
+                                       'el_id' => $this->mDb->nextSequenceValue( 'externallinks_el_id_seq' ),
                                        'el_from' => $this->mId,
                                        'el_to' => $url,
                                        'el_index' => $index,
index 55fbd9a..02d65ed 100644 (file)
@@ -66,11 +66,13 @@ class FixExtLinksProtocolRelative extends LoggedUpdateMaintenance {
                        $db->insert( 'externallinks',
                                array(
                                        array(
+                                               'el_id' => $db->nextSequenceValue( 'externallinks_el_id_seq' ),
                                                'el_from' => $row->el_from,
                                                'el_to' => $row->el_to,
                                                'el_index' => "http:{$row->el_index}",
                                        ),
                                        array(
+                                               'el_id' => $db->nextSequenceValue( 'externallinks_el_id_seq' ),
                                                'el_from' => $row->el_from,
                                                'el_to' => $row->el_to,
                                                'el_index' => "https:{$row->el_index}",