From: Aaron Schulz Date: Wed, 17 May 2017 02:20:42 +0000 (-0700) Subject: Make sure unique keys carry over to postgres table duplicates X-Git-Tag: 1.31.0-rc.0~3232^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=44577c39621b4540dacbbc916626c4910df6361d;p=lhc%2Fweb%2Fwiklou.git Make sure unique keys carry over to postgres table duplicates This fixes BotPasswordTest failures. Change-Id: I81003187af0c57020f9fc4cbcd2606e71907a903 --- 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() );