1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 03:54:10 +01:00

[ticket/12170] Assign schema keys in migration helper with data_depth 1

The migration helper currently drops any keys with schema changes that have
the data_depth 1. This change will correctly assign the keys to the steps
array without dropping the keys that might contain important info like the
actual table that should be created.

PHPBB3-12170
This commit is contained in:
Marc Alexander 2014-02-07 20:49:13 +01:00
parent 344baf9180
commit e8f8dcf0ea
3 changed files with 14 additions and 1 deletions

View File

@ -53,7 +53,7 @@ class helper
$steps[] = array(
'dbtools.perform_schema_changes', array(array(
$change_type => array(
$value,
(!is_int($key)) ? $key : 0 => $value,
),
)),
);

View File

@ -17,6 +17,14 @@ class phpbb_dbal_migration_schema extends \phpbb\db\migration\migration
'test_column1' => array('BOOL', 1),
),
),
'add_tables' => array(
$this->table_prefix . 'foobar' => array(
'COLUMNS' => array(
'module_id' => array('UINT:3', NULL, 'auto_increment'),
),
'PRIMARY_KEY' => 'module_id',
),
),
);
}
@ -28,6 +36,9 @@ class phpbb_dbal_migration_schema extends \phpbb\db\migration\migration
'test_column1',
),
),
'drop_tables' => array(
$this->table_prefix . 'foobar',
),
);
}
}

View File

@ -280,6 +280,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
}
$this->assertTrue($this->db_tools->sql_column_exists('phpbb_config', 'test_column1'));
$this->assertTrue($this->db_tools->sql_table_exists('phpbb_foobar'));
while ($this->migrator->migration_state('phpbb_dbal_migration_schema'))
{
@ -287,5 +288,6 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
}
$this->assertFalse($this->db_tools->sql_column_exists('phpbb_config', 'test_column1'));
$this->assertFalse($this->db_tools->sql_table_exists('phpbb_foobar'));
}
}