Hoo man has uploaded a new change for review. https://gerrit.wikimedia.org/r/229613
Change subject: Duplicate table indexes in DatabaseSqlite::duplicateTableStructure ...................................................................... Duplicate table indexes in DatabaseSqlite::duplicateTableStructure This is consistent with what we do with MySQL and is generally convenient to have for certain integration tests. Change-Id: Iaea79bd11263bf75061f19a94da9645ef634422f --- M includes/db/DatabaseSqlite.php 1 file changed, 29 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/13/229613/1 diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 2bad711..9a6c678 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -964,7 +964,35 @@ } } - return $this->query( $sql, $fname ); + $res = $this->query( $sql, $fname ); + + // Take over indexes + $indexList = $this->query( 'PRAGMA INDEX_LIST(' . $this->addQuotes( $oldName ) . ')' ); + foreach( $indexList as $index ) { + if ( strpos( $index->name, 'sqlite_autoindex' ) === 0 ) { + continue; + } + + if ( $index->unique ) { + $sql = 'CREATE UNIQUE INDEX'; + } else { + $sql = 'CREATE INDEX'; + } + $sql .= ' ' . $this->indexName( $index->name ) . ' ON ' . $newName; + + $indexInfo = $this->query( 'PRAGMA INDEX_INFO(' . $this->addQuotes( $index->name ) . ')' ); + $fields = array(); + foreach ( $indexInfo as $indexInfoRow ) { + $fields[ $indexInfoRow->seqno ] = $indexInfoRow->name; + } + + $sql .= '(' . implode( ',', $fields ) . ')'; + $sql = $this->replaceVars( $sql ); + + $this->query( $sql ); + } + + return $res; } /** -- To view, visit https://gerrit.wikimedia.org/r/229613 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaea79bd11263bf75061f19a94da9645ef634422f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Hoo man <h...@online.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits