Revert "Remove old remapping hacks from Database::indexName()"
authorReedy <reedy@wikimedia.org>
Fri, 24 Mar 2017 11:52:00 +0000 (11:52 +0000)
committerReedy <reedy@wikimedia.org>
Fri, 24 Mar 2017 11:52:47 +0000 (11:52 +0000)
This reverts commit bec6151e5fe30e780d82527c4c53e54379149a4e.

Bug: T154872
Change-Id: I1c67aa464a1f151562ef92fce03f825113847814

includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabaseSqlite.php

index 4f663b3..7e80221 100644 (file)
@@ -1981,7 +1981,18 @@ abstract class Database implements IDatabase, LoggerAwareInterface {
         * @return string
         */
        protected function indexName( $index ) {
         * @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 ) {
        }
 
        public function addQuotes( $s ) {
index f201dad..2281f23 100644 (file)
@@ -426,6 +426,16 @@ class DatabaseSqlite extends DatabaseBase {
                return str_replace( '"', '', parent::tableName( $name, $format ) );
        }
 
                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
         *
        /**
         * This must be called after nextSequenceVal
         *