1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-13 19:15:20 +02:00

[feature/migrations] Return schema changes in database update style array

Returning the set of schema changes allows potentially aggregating to generate
the overall install schema automatically from a set of migrations

PHPBB3-9737
This commit is contained in:
Nils Adermann 2012-10-25 12:26:44 -07:00 committed by Nathan Guse
parent d304b6449d
commit 8645321f40
3 changed files with 16 additions and 4 deletions

View File

@ -52,12 +52,13 @@ class phpbb_db_migration
} }
/** /**
* Updates the database schema * Updates the database schema by providing a set of change instructions
* *
* @return null * @return array
*/ */
function update_schema() function update_schema()
{ {
return array();
} }
/** /**

View File

@ -151,7 +151,7 @@ class phpbb_db_migrator
if (!$state['migration_schema_done']) if (!$state['migration_schema_done'])
{ {
$migration->update_schema(); $this->apply_schema_changes($migration->update_schema());
$state['migration_schema_done'] = true; $state['migration_schema_done'] = true;
} }
else else
@ -245,4 +245,9 @@ class phpbb_db_migrator
return true; return true;
} }
function apply_schema_changes($schema_changes)
{
$this->db_tools->perform_schema_changes($schema_changes);
}
} }

View File

@ -16,7 +16,13 @@ class phpbb_dbal_migration_dummy extends phpbb_db_migration
function update_schema() function update_schema()
{ {
$this->db_column_add('phpbb_config', 'extra_column', array('UINT', 0)); return array(
'add_columns' => array(
'phpbb_config' => array(
'extra_column' => array('UINT', 0),
),
),
);
} }
function update_data() function update_data()