aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dbal/migration
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-07-15 11:57:53 -0400
committerNathan Guse <nathaniel.guse@gmail.com>2013-01-09 16:39:59 -0600
commitf817e20f287a21e2dddfba9721f5e02dce162d29 (patch)
treef78eec7bd0b090fb564048b87d01669b155e1627 /tests/dbal/migration
parent0e9b7bcae98ec5f864ad8f183ded4fc0040cec28 (diff)
downloadforums-f817e20f287a21e2dddfba9721f5e02dce162d29.tar
forums-f817e20f287a21e2dddfba9721f5e02dce162d29.tar.gz
forums-f817e20f287a21e2dddfba9721f5e02dce162d29.tar.bz2
forums-f817e20f287a21e2dddfba9721f5e02dce162d29.tar.xz
forums-f817e20f287a21e2dddfba9721f5e02dce162d29.zip
[feature/migrations] Basic migrations with schema and data changes
The migrator takes care of applying migrations as necessary. RFC: http://area51.phpbb.com/phpBB/viewtopic.php?f=84&t=41337 PHPBB3-9737
Diffstat (limited to 'tests/dbal/migration')
-rw-r--r--tests/dbal/migration/dummy.php26
-rw-r--r--tests/dbal/migration/unfulfillable.php26
2 files changed, 52 insertions, 0 deletions
diff --git a/tests/dbal/migration/dummy.php b/tests/dbal/migration/dummy.php
new file mode 100644
index 0000000000..b286d44f77
--- /dev/null
+++ b/tests/dbal/migration/dummy.php
@@ -0,0 +1,26 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+class phpbb_dbal_migration_dummy extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('installed_migration');
+ }
+
+ function update_schema()
+ {
+ $this->db_column_add('phpbb_config', 'extra_column', array('UINT', 0));
+ }
+
+ function update_data()
+ {
+ $this->db->sql_query('UPDATE phpbb_config SET extra_column = 1');
+ }
+}
diff --git a/tests/dbal/migration/unfulfillable.php b/tests/dbal/migration/unfulfillable.php
new file mode 100644
index 0000000000..84136ffe6d
--- /dev/null
+++ b/tests/dbal/migration/unfulfillable.php
@@ -0,0 +1,26 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+class phpbb_dbal_migration_unfulfillable extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('installed_migration', 'phpbb_dbal_migration_dummy', 'non_existant_migration');
+ }
+
+ function update_schema()
+ {
+ trigger_error('Schema update of migration with unfulfillable dependency was run!');
+ }
+
+ function update_data()
+ {
+ trigger_error('Data update of migration with unfulfillable dependency was run!');
+ }
+}