From 8645321f40d0b13de6201688c69f9f05bc649dcf Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 25 Oct 2012 12:26:44 -0700 Subject: [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 --- phpBB/includes/db/migration.php | 5 +++-- phpBB/includes/db/migrator.php | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/db') diff --git a/phpBB/includes/db/migration.php b/phpBB/includes/db/migration.php index f96fcb9568..ee916aedc0 100644 --- a/phpBB/includes/db/migration.php +++ b/phpBB/includes/db/migration.php @@ -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() { + return array(); } /** diff --git a/phpBB/includes/db/migrator.php b/phpBB/includes/db/migrator.php index f4613e3aec..4a178af468 100644 --- a/phpBB/includes/db/migrator.php +++ b/phpBB/includes/db/migrator.php @@ -151,7 +151,7 @@ class phpbb_db_migrator if (!$state['migration_schema_done']) { - $migration->update_schema(); + $this->apply_schema_changes($migration->update_schema()); $state['migration_schema_done'] = true; } else @@ -245,4 +245,9 @@ class phpbb_db_migrator return true; } + + function apply_schema_changes($schema_changes) + { + $this->db_tools->perform_schema_changes($schema_changes); + } } -- cgit v1.2.1