aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dbal
diff options
context:
space:
mode:
authorPatrick Webster <noxwizard@phpbb.com>2014-06-15 14:52:05 -0500
committerPatrick Webster <noxwizard@phpbb.com>2014-06-15 19:07:32 -0500
commit754e36e378e9d5d744fcfd6d447bd1e48d2052c3 (patch)
tree297de5bfd2d0b2fbf2a21ab5bf81864b928c8a4f /tests/dbal
parente6a8df7f7ea2036ae9943368ad1ea2cee7cd5655 (diff)
downloadforums-754e36e378e9d5d744fcfd6d447bd1e48d2052c3.tar
forums-754e36e378e9d5d744fcfd6d447bd1e48d2052c3.tar.gz
forums-754e36e378e9d5d744fcfd6d447bd1e48d2052c3.tar.bz2
forums-754e36e378e9d5d744fcfd6d447bd1e48d2052c3.tar.xz
forums-754e36e378e9d5d744fcfd6d447bd1e48d2052c3.zip
[ticket/12643] Properly handle changing columns on tables with constraints
PHPBB3-12643
Diffstat (limited to 'tests/dbal')
-rw-r--r--tests/dbal/db_tools_test.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php
index 7cf05a34d4..f3c6888c8d 100644
--- a/tests/dbal/db_tools_test.php
+++ b/tests/dbal/db_tools_test.php
@@ -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'));