mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-17 16:58:51 +00:00
Returning the set of schema changes allows potentially aggregating to generate the overall install schema automatically from a set of migrations PHPBB3-9737
80 lines
1.3 KiB
PHP
80 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
*
|
|
* @package db
|
|
* @copyright (c) 2011 phpBB Group
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
*
|
|
*/
|
|
|
|
/**
|
|
* @ignore
|
|
*/
|
|
if (!defined('IN_PHPBB'))
|
|
{
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* Abstract base class for database migrations
|
|
*
|
|
* Each migration consists of a set of schema and data changes to be implemented
|
|
* in a subclass. This class provides various utility methods to simplify editing
|
|
* a phpBB.
|
|
*
|
|
* @package db
|
|
*/
|
|
class phpbb_db_migration
|
|
{
|
|
var $db;
|
|
var $db_tools;
|
|
|
|
/**
|
|
* Migration constructor
|
|
*
|
|
* @param dbal $db Connected database abstraction instance
|
|
* @param phpbb_db_tools $db_tools Instance of db schema manipulation tools
|
|
*/
|
|
function phpbb_db_migration(&$db, &$db_tools)
|
|
{
|
|
$this->db = &$db;
|
|
$this->db_tools = &$db_tools;
|
|
}
|
|
|
|
/**
|
|
* Defines other migrationsto be applied first (abstract method)
|
|
*
|
|
* @return array An array of migration class names
|
|
*/
|
|
function depends_on()
|
|
{
|
|
return array();
|
|
}
|
|
|
|
/**
|
|
* Updates the database schema by providing a set of change instructions
|
|
*
|
|
* @return array
|
|
*/
|
|
function update_schema()
|
|
{
|
|
return array();
|
|
}
|
|
|
|
/**
|
|
* Updates data
|
|
*
|
|
* @return null
|
|
*/
|
|
function update_data()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Adds a column to a database table
|
|
*/
|
|
function db_column_add($table_name, $column_name, $column_data)
|
|
{
|
|
$this->db_tools->sql_column_add($table_name, $column_name, $column_data);
|
|
}
|
|
}
|