diff options
author | Nils Adermann <naderman@naderman.de> | 2012-04-10 01:14:42 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2012-04-10 01:14:42 +0200 |
commit | 41e03164c19751624968435f31f1b63367cd4eb2 (patch) | |
tree | a49b91522b38efc787b950aebbd41ca9f20049bc | |
parent | e57e82d478feccc3a995b71118663e7f65c02ea7 (diff) | |
parent | ef297ec63e8328dc13a8d79d7c01d2d7322a263b (diff) | |
download | forums-41e03164c19751624968435f31f1b63367cd4eb2.tar forums-41e03164c19751624968435f31f1b63367cd4eb2.tar.gz forums-41e03164c19751624968435f31f1b63367cd4eb2.tar.bz2 forums-41e03164c19751624968435f31f1b63367cd4eb2.tar.xz forums-41e03164c19751624968435f31f1b63367cd4eb2.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/10774] Correctly specify index name when creating unique index on MySQL.
[ticket/10774] Add unit tests for UNIQUE index existence and creation.
-rw-r--r-- | phpBB/includes/db/db_tools.php | 2 | ||||
-rw-r--r-- | tests/dbal/db_tools_test.php | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index f9f4c97309..efb8b3ebd7 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -2114,7 +2114,7 @@ class phpbb_db_tools case 'mysql_40': case 'mysql_41': - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD UNIQUE INDEX (' . implode(', ', $column) . ')'; + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD UNIQUE INDEX ' . $index_name . '(' . implode(', ', $column) . ')'; break; case 'mssql': diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index fbde636b58..c7ddb88ce8 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -354,9 +354,20 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'i_simple')); } + public function test_unique_index_exists() + { + $this->assertTrue($this->tools->sql_unique_index_exists('prefix_table_name', 'i_uniq')); + } + public function test_create_index_against_index_exists() { $this->tools->sql_create_index('prefix_table_name', 'fookey', array('c_timestamp', 'c_decimal')); $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'fookey')); } + + public function test_create_unique_index_against_unique_index_exists() + { + $this->tools->sql_create_unique_index('prefix_table_name', 'i_uniq_ts_id', array('c_timestamp', 'c_id')); + $this->assertTrue($this->tools->sql_unique_index_exists('prefix_table_name', 'i_uniq_ts_id')); + } } |