1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-22 15:31:28 +02:00

Merge remote-tracking branch 'bantu/ticket/10327' into develop-olympus

* bantu/ticket/10327:
  [ticket/10327] Change CREATE INDEX to ALTER TABLE table ADD INDEX for MySQL.
This commit is contained in:
Igor Wiedler 2011-10-14 14:34:44 +02:00
commit 1657339e6d
2 changed files with 19 additions and 1 deletions

View File

@ -2145,7 +2145,7 @@ class phpbb_db_tools
} }
// no break // no break
case 'mysql_41': case 'mysql_41':
$statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; $statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . '(' . implode(', ', $column) . ')';
break; break;
case 'mssql': case 'mssql':

View File

@ -333,4 +333,22 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
), ),
)); ));
} }
public function test_index_exists()
{
$db_tools = new phpbb_db_tools($this->db);
$this->assertTrue($db_tools->sql_index_exists('prefix_table_name', 'i_simple'));
}
public function test_create_index_against_index_exists()
{
$db_tools = new phpbb_db_tools($this->db);
$table_name = 'prefix_table_name';
$index_name = 'fookey';
$db_tools->sql_create_index($table_name, $index_name, array('c_timestamp', 'c_decimal'));
$this->assertTrue($db_tools->sql_index_exists($table_name, $index_name));
}
} }