mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-06 22:45:02 +02:00
Merge remote-tracking branch 'github-bantu/ticket/10774' into develop-olympus
* github-bantu/ticket/10774: [ticket/10774] Correctly specify index name when creating unique index on MySQL. [ticket/10774] Add unit tests for UNIQUE index existence and creation.
This commit is contained in:
commit
ef297ec63e
@ -2115,7 +2115,7 @@ class phpbb_db_tools
|
|||||||
|
|
||||||
case 'mysql_40':
|
case 'mysql_40':
|
||||||
case 'mysql_41':
|
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;
|
break;
|
||||||
|
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
|
@ -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'));
|
$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()
|
public function test_create_index_against_index_exists()
|
||||||
{
|
{
|
||||||
$this->tools->sql_create_index('prefix_table_name', 'fookey', array('c_timestamp', 'c_decimal'));
|
$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'));
|
$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'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user