Commit 6cd48a6d authored by alexpott's avatar alexpott

Issue #2463263 by amateescu: SQLite: Fix system\Tests\Entity\EntityDefinitionUpdateTest

parent 80f8335c
......@@ -489,6 +489,13 @@ public function dropField($table, $field) {
$new_schema = $old_schema;
unset($new_schema['fields'][$field]);
// Handle possible primary key changes.
if (isset($new_schema['primary key']) && ($key = array_search($field, $new_schema['primary key'])) !== FALSE) {
unset($new_schema['primary key'][$key]);
}
// Handle possible index changes.
foreach ($new_schema['indexes'] as $index => $fields) {
foreach ($fields as $key => $field_name) {
if ($field_name == $field) {
......
......@@ -444,6 +444,11 @@ protected function assertFieldAdditionRemoval($field_spec) {
// Clean-up.
db_drop_field($table_name, 'test_field');
// Add back the field and then try to delete a field which is also a primary
// key.
db_add_field($table_name, 'test_field', $field_spec);
db_drop_field($table_name, 'serial_column');
db_drop_table($table_name);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment