From a33048bb8b4a1c7717c0760acd03563bf937687d Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 3 Jan 2014 20:36:20 +0100 Subject: [PATCH] Add sequence support for externallinks table 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 | 1 + maintenance/fixExtLinksProtocolRelative.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index d5ed250af3..6e0cebff75 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -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, diff --git a/maintenance/fixExtLinksProtocolRelative.php b/maintenance/fixExtLinksProtocolRelative.php index 55fbd9a350..02d65ed154 100644 --- a/maintenance/fixExtLinksProtocolRelative.php +++ b/maintenance/fixExtLinksProtocolRelative.php @@ -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}", -- 2.20.1