From 44577c39621b4540dacbbc916626c4910df6361d Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 16 May 2017 19:20:42 -0700 Subject: [PATCH] Make sure unique keys carry over to postgres table duplicates This fixes BotPasswordTest failures. Change-Id: I81003187af0c57020f9fc4cbcd2606e71907a903 --- includes/libs/rdbms/database/DatabasePostgres.php | 2 +- tests/phpunit/includes/user/BotPasswordTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php index 6cf890dfc1..f84ffa9b12 100644 --- a/includes/libs/rdbms/database/DatabasePostgres.php +++ b/includes/libs/rdbms/database/DatabasePostgres.php @@ -828,7 +828,7 @@ __INDEXATTR__; $oldName = $this->addIdentifierQuotes( $oldName ); return $this->query( 'CREATE ' . ( $temporary ? 'TEMPORARY ' : '' ) . " TABLE $newName " . - "(LIKE $oldName INCLUDING DEFAULTS)", $fname ); + "(LIKE $oldName INCLUDING DEFAULTS INCLUDING INDEXES)", $fname ); } public function listTables( $prefix = null, $fname = __METHOD__ ) { diff --git a/tests/phpunit/includes/user/BotPasswordTest.php b/tests/phpunit/includes/user/BotPasswordTest.php index 58f1e5f7d3..09cf350729 100644 --- a/tests/phpunit/includes/user/BotPasswordTest.php +++ b/tests/phpunit/includes/user/BotPasswordTest.php @@ -382,6 +382,8 @@ class BotPasswordTest extends MediaWikiTestCase { } $token = $bp->getToken(); + $this->assertEquals( 42, $bp->getUserCentralId() ); + $this->assertEquals( 'TestSave', $bp->getAppId() ); $this->assertFalse( $bp->save( 'insert' ) ); $this->assertTrue( $bp->save( 'update' ) ); $this->assertNotEquals( $token, $bp->getToken() ); -- 2.20.1