aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-01-30 14:21:16 +0100
committerRobin Appelman <icewind@owncloud.com>2014-06-03 11:17:21 +0200
commit0035147be96537193f0c7119dfd0628fe7363a26 (patch)
tree4af065ac1c7410603173c48890c6591879f2fcc0 /tests
parent9c6a93a87c835dee5fb0b580865d4f70836685cf (diff)
downloadnextcloud-server-0035147be96537193f0c7119dfd0628fe7363a26.tar.gz
nextcloud-server-0035147be96537193f0c7119dfd0628fe7363a26.zip
Create unique names for temporary indexes
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/db/migrator.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/lib/db/migrator.php b/tests/lib/db/migrator.php
index ed7c36dbdf4..e08f1cf4547 100644
--- a/tests/lib/db/migrator.php
+++ b/tests/lib/db/migrator.php
@@ -20,30 +20,33 @@ class Migrator extends \PHPUnit_Framework_TestCase {
private $tableName;
+ private $fullTableName;
+
public function setUp() {
$this->tableName = 'test_' . uniqid();
$this->connection = \OC_DB::getConnection();
- $this->tableName = $this->connection->getDatabase() . '.' . $this->tableName;
+ $this->fullTableName = $this->connection->getDatabase() . '.' . $this->tableName;
}
public function tearDown() {
- $this->connection->exec('DROP TABLE ' . $this->tableName);
+ $this->connection->exec('DROP TABLE ' . $this->fullTableName);
}
private function getInitialSchema() {
$schema = new Schema(array(), array(), $this->getSchemaConfig());
- $table = $schema->createTable($this->tableName);
+ $table = $schema->createTable($this->fullTableName);
$table->addColumn('id', 'integer');
$table->addColumn('name', 'string');
+ $table->addIndex(array('id'), $this->tableName . '_id');
return $schema;
}
private function getNewSchema() {
$schema = new Schema(array(), array(), $this->getSchemaConfig());
- $table = $schema->createTable($this->tableName);
+ $table = $schema->createTable($this->fullTableName);
$table->addColumn('id', 'integer');
$table->addColumn('name', 'string');
- $table->addUniqueIndex(array('id'));
+ $table->addUniqueIndex(array('id'), $this->tableName . '_id');
return $schema;
}