mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[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
This commit is contained in:
committed by
Nathan Guse
parent
0e9b7bcae9
commit
f817e20f28
26
tests/dbal/migration/dummy.php
Normal file
26
tests/dbal/migration/dummy.php
Normal file
@@ -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');
|
||||
}
|
||||
}
|
26
tests/dbal/migration/unfulfillable.php
Normal file
26
tests/dbal/migration/unfulfillable.php
Normal file
@@ -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!');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user