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

Merge branch 'develop-ascraeus' into develop

* develop-ascraeus:
  [ticket/12643] Properly handle changing columns on tables with constraints
  [ticket/12643] Tests dropping similarly named columns
  [ticket/12643] Ensure that similarly named columns are not removed
This commit is contained in:
Andreas Fischer
2014-06-16 15:14:10 +02:00
2 changed files with 42 additions and 2 deletions

View File

@@ -239,6 +239,24 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
$this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012'));
}
public function test_column_change_with_composite_primary()
{
// Remove the old primary key
$this->assertTrue($this->tools->sql_column_remove('prefix_table_name', 'c_id'));
$this->assertTrue($this->tools->sql_column_add('prefix_table_name', 'c_id', array('UINT', 0)));
// Create a composite key
$this->assertTrue($this->tools->sql_create_primary_key('prefix_table_name', array('c_id', 'c_uint')));
// Create column
$this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12643'));
$this->assertTrue($this->tools->sql_column_add('prefix_table_name', 'c_bug_12643', array('DECIMAL', 0)));
$this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12643'));
// Change type from int to string
$this->assertTrue($this->tools->sql_column_change('prefix_table_name', 'c_bug_12643', array('VCHAR:100', '')));
}
public function test_column_remove()
{
$this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_int_size'));
@@ -248,6 +266,17 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
$this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_int_size'));
}
public function test_column_remove_similar_name()
{
$this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_vchar'));
$this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_vchar_size'));
$this->assertTrue($this->tools->sql_column_remove('prefix_table_name', 'c_vchar'));
$this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_vchar'));
$this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_vchar_size'));
}
public function test_column_remove_with_index()
{
// Create column