Merge "Revert "Remove old remapping hacks from Database::indexName()""
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 30 Mar 2017 02:32:53 +0000 (02:32 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 30 Mar 2017 02:32:54 +0000 (02:32 +0000)
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabaseSqlite.php

index beb38bc..fbfd899 100644 (file)
@@ -1957,7 +1957,18 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
         * @return string
         */
        protected function indexName( $index ) {
-               return $index;
+               // Backwards-compatibility hack
+               $renamed = [
+                       'ar_usertext_timestamp' => 'usertext_timestamp',
+                       'un_user_id' => 'user_id',
+                       'un_user_ip' => 'user_ip',
+               ];
+
+               if ( isset( $renamed[$index] ) ) {
+                       return $renamed[$index];
+               } else {
+                       return $index;
+               }
        }
 
        public function addQuotes( $s ) {
index 090ce8e..2a5deb6 100644 (file)
@@ -430,6 +430,16 @@ class DatabaseSqlite extends Database {
                return str_replace( '"', '', parent::tableName( $name, $format ) );
        }
 
+       /**
+        * Index names have DB scope
+        *
+        * @param string $index
+        * @return string
+        */
+       protected function indexName( $index ) {
+               return $index;
+       }
+
        /**
         * This must be called after nextSequenceVal
         *