mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[feature/migrations] Revert schema for migration data
PHPBB3-9737
This commit is contained in:
parent
bb99a2609d
commit
ca55f6c481
41 changed files with 314 additions and 168 deletions
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_1 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_1_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_10 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_10_rc3');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_10_rc1 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_9');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_10_rc2 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_10_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_10_rc3 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_10_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_11 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_11_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_11_rc1 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_10');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -25,6 +25,17 @@ class phpbb_db_migration_data_3_0_11_rc2 extends phpbb_db_migration
|
|||
);
|
||||
}
|
||||
|
||||
function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'profile_fields' => array(
|
||||
'field_show_novalue',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -16,11 +16,6 @@ class phpbb_db_migration_data_3_0_12_rc1 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_11');
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -26,7 +26,9 @@ class phpbb_db_migration_data_3_0_1_rc1 extends phpbb_db_migration
|
|||
),
|
||||
),
|
||||
'drop_keys' => array(
|
||||
$this->table_prefix . 'groups' => array('group_legend'),
|
||||
$this->table_prefix . 'groups' => array(
|
||||
'group_legend',
|
||||
),
|
||||
),
|
||||
'add_index' => array(
|
||||
$this->table_prefix . 'sessions' => array(
|
||||
|
@ -52,12 +54,16 @@ class phpbb_db_migration_data_3_0_1_rc1 extends phpbb_db_migration
|
|||
),
|
||||
'add_index' => array(
|
||||
$this->table_prefix . 'groups' => array(
|
||||
'group_legend' => 'group_legend',
|
||||
'group_legend' => array('group_legend'),
|
||||
),
|
||||
),
|
||||
'drop_keys' => array(
|
||||
$this->table_prefix . 'sessions' => array('session_forum_id'),
|
||||
$this->table_prefix . 'groups' => array('group_legend_name'),
|
||||
$this->table_prefix . 'sessions' => array(
|
||||
'session_forum_id',
|
||||
),
|
||||
$this->table_prefix . 'groups' => array(
|
||||
'group_legend_name',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_2 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_2_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_2_rc1 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_1');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -36,7 +36,9 @@ class phpbb_db_migration_data_3_0_2_rc2 extends phpbb_db_migration
|
|||
),
|
||||
),
|
||||
'drop_keys' => array(
|
||||
$this->table_prefix . 'sessions' => array('session_forum_id'),
|
||||
$this->table_prefix . 'sessions' => array(
|
||||
'session_forum_id',
|
||||
),
|
||||
),
|
||||
'add_index' => array(
|
||||
$this->table_prefix . 'sessions' => array(
|
||||
|
@ -46,6 +48,24 @@ class phpbb_db_migration_data_3_0_2_rc2 extends phpbb_db_migration
|
|||
);
|
||||
}
|
||||
|
||||
function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'add_index' => array(
|
||||
$this->table_prefix . 'sessions' => array(
|
||||
'session_forum_id' => array(
|
||||
'session_forum_id',
|
||||
),
|
||||
),
|
||||
),
|
||||
'drop_keys' => array(
|
||||
$this->table_prefix . 'sessions' => array(
|
||||
'session_fid',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_3 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_3_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -29,6 +29,21 @@ class phpbb_db_migration_data_3_0_3_rc1 extends phpbb_db_migration
|
|||
);
|
||||
}
|
||||
|
||||
function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'styles_template' => array(
|
||||
'template_inherits_id',
|
||||
'template_inherit_path',
|
||||
),
|
||||
$this->table_prefix . 'groups' => array(
|
||||
'group_max_recipients',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_4 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_4_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -55,6 +55,17 @@ class phpbb_db_migration_data_3_0_4_rc1 extends phpbb_db_migration
|
|||
);
|
||||
}
|
||||
|
||||
function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'profile_fields' => array(
|
||||
'field_show_profile',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_5 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_5_rc1part2');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -18,10 +18,10 @@ class phpbb_db_migration_data_3_0_5_rc1part2 extends phpbb_db_migration
|
|||
{
|
||||
return array(
|
||||
'drop_keys' => array(
|
||||
ACL_OPTIONS_TABLE => array('auth_option'),
|
||||
$this->table_prefix . 'acl_options' => array('auth_option'),
|
||||
),
|
||||
'add_unique_index' => array(
|
||||
ACL_OPTIONS_TABLE => array(
|
||||
$this->table_prefix . 'acl_options' => array(
|
||||
'auth_option' => array('auth_option'),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_6 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_6_rc4');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -59,6 +59,46 @@ class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
|
|||
);
|
||||
}
|
||||
|
||||
function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'confirm' => array(
|
||||
'attempts',
|
||||
),
|
||||
$this->table_prefix . 'users' => array(
|
||||
'user_new',
|
||||
'user_reminded',
|
||||
'user_reminded_time',
|
||||
),
|
||||
$this->table_prefix . 'groups' => array(
|
||||
'group_skip_auth',
|
||||
),
|
||||
$this->table_prefix . 'privmsgs' => array(
|
||||
'message_reported',
|
||||
),
|
||||
$this->table_prefix . 'reports' => array(
|
||||
'pm_id',
|
||||
),
|
||||
$this->table_prefix . 'profile_fields' => array(
|
||||
'field_show_on_vt',
|
||||
),
|
||||
$this->table_prefix . 'forums' => array(
|
||||
'forum_options',
|
||||
),
|
||||
),
|
||||
'drop_keys' => array(
|
||||
$this->table_prefix . 'reports' => array(
|
||||
'post_id',
|
||||
'pm_id',
|
||||
),
|
||||
$this->table_prefix . 'posts' => array(
|
||||
'post_username',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_6_rc2 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_6_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_6_rc3 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_6_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_6_rc4 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_6_rc3');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_7 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_7_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_7_pl1 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_7');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -18,7 +18,9 @@ class phpbb_db_migration_data_3_0_7_rc1 extends phpbb_db_migration
|
|||
{
|
||||
return array(
|
||||
'drop_keys' => array(
|
||||
$this->table_prefix . 'log' => array('log_time'),
|
||||
$this->table_prefix . 'log' => array(
|
||||
'log_time',
|
||||
),
|
||||
),
|
||||
'add_index' => array(
|
||||
$this->table_prefix . 'topics_track' => array(
|
||||
|
@ -28,6 +30,22 @@ class phpbb_db_migration_data_3_0_7_rc1 extends phpbb_db_migration
|
|||
);
|
||||
}
|
||||
|
||||
function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'add_index' => array(
|
||||
$this->table_prefix . 'log' => array(
|
||||
'log_time' => array('log_time'),
|
||||
),
|
||||
),
|
||||
'drop_keys' => array(
|
||||
$this->table_prefix . 'topics_track' => array(
|
||||
'topic_id',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_7_rc2 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_7_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_8 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_8_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_8_rc1 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_7_pl1');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_9 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_9_rc4');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -51,6 +51,15 @@ class phpbb_db_migration_data_3_0_9_rc1 extends phpbb_db_migration
|
|||
);
|
||||
}
|
||||
|
||||
function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_tables' => array(
|
||||
$this->table_prefix . 'login_attempts',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_9_rc2 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_9_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_9_rc3 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_9_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_3_0_9_rc4 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_9_rc3');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -15,7 +15,7 @@ class phpbb_db_migration_data_3_1_0_dev extends phpbb_db_migration
|
|||
'phpbb_db_migration_data_3_0_11',
|
||||
'phpbb_db_migration_data_extensions',
|
||||
'phpbb_db_migration_data_style_update_p2',
|
||||
'phpbb_db_migration_data_timezone',
|
||||
'phpbb_db_migration_data_timezone_p2',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -23,32 +23,57 @@ class phpbb_db_migration_data_3_1_0_dev extends phpbb_db_migration
|
|||
{
|
||||
return array(
|
||||
'add_columns' => array(
|
||||
GROUPS_TABLE => array(
|
||||
$this->table_prefix . 'groups' => array(
|
||||
'group_teampage' => array('UINT', 0, 'after' => 'group_legend'),
|
||||
),
|
||||
PROFILE_FIELDS_TABLE => array(
|
||||
$this->table_prefix . 'profile_fields' => array(
|
||||
'field_show_on_pm' => array('BOOL', 0),
|
||||
),
|
||||
STYLES_TABLE => array(
|
||||
$this->table_prefix . 'styles' => array(
|
||||
'style_path' => array('VCHAR:100', ''),
|
||||
'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
|
||||
'style_parent_id' => array('UINT:4', 0),
|
||||
'style_parent_tree' => array('TEXT', ''),
|
||||
),
|
||||
REPORTS_TABLE => array(
|
||||
$this->table_prefix . 'reports' => array(
|
||||
'reported_post_text' => array('MTEXT_UNI', ''),
|
||||
'reported_post_uid' => array('VCHAR:8', ''),
|
||||
'reported_post_bitfield' => array('VCHAR:255', ''),
|
||||
),
|
||||
),
|
||||
'change_columns' => array(
|
||||
GROUPS_TABLE => array(
|
||||
$this->table_prefix . 'groups' => array(
|
||||
'group_legend' => array('UINT', 0),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'groups' => array(
|
||||
'group_teampage',
|
||||
),
|
||||
$this->table_prefix . 'profile_fields' => array(
|
||||
'field_show_on_pm',
|
||||
),
|
||||
$this->table_prefix . 'styles' => array(
|
||||
'style_path',
|
||||
'bbcode_bitfield',
|
||||
'style_parent_id',
|
||||
'style_parent_tree',
|
||||
),
|
||||
$this->table_prefix . 'reports' => array(
|
||||
'reported_post_text',
|
||||
'reported_post_uid',
|
||||
'reported_post_bitfield',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -18,7 +18,7 @@ class phpbb_db_migration_data_extensions extends phpbb_db_migration
|
|||
{
|
||||
return array(
|
||||
'add_tables' => array(
|
||||
EXT_TABLE => array(
|
||||
$this->table_prefix . 'ext' => array(
|
||||
'COLUMNS' => array(
|
||||
'ext_name' => array('VCHAR', ''),
|
||||
'ext_active' => array('BOOL', 0),
|
||||
|
@ -32,6 +32,15 @@ class phpbb_db_migration_data_extensions extends phpbb_db_migration
|
|||
);
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_tables' => array(
|
||||
$this->table_prefix . 'ext',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
|
|
|
@ -14,11 +14,6 @@ class phpbb_db_migration_data_style_update_p1 extends phpbb_db_migration
|
|||
return array('phpbb_db_migration_data_3_0_11');
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
|
@ -47,10 +42,10 @@ class phpbb_db_migration_data_style_update_p1 extends phpbb_db_migration
|
|||
}
|
||||
|
||||
// Get all installed styles
|
||||
if ($this->db_tools->sql_table_exists(STYLES_IMAGESET_TABLE))
|
||||
if ($this->db_tools->sql_table_exists($this->table_prefix . 'styles_imageset'))
|
||||
{
|
||||
$sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_id, i.imageset_path
|
||||
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c, ' . STYLES_IMAGESET_TABLE . " i
|
||||
FROM ' . STYLES_TABLE . ' s, ' . $this->table_prefix . 'styles_template t, ' . $this->table_prefix . 'styles_theme c, ' . $this->table_prefix . "styles_imageset i
|
||||
WHERE t.template_id = s.template_id
|
||||
AND c.theme_id = s.theme_id
|
||||
AND i.imageset_id = s.imageset_id";
|
||||
|
@ -58,7 +53,7 @@ class phpbb_db_migration_data_style_update_p1 extends phpbb_db_migration
|
|||
else
|
||||
{
|
||||
$sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_id
|
||||
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . " c
|
||||
FROM ' . STYLES_TABLE . ' s, ' . $this->table_prefix . 'styles_template t, ' . $this->table_prefix . "stles_theme c
|
||||
WHERE t.template_id = s.template_id
|
||||
AND c.theme_id = s.theme_id";
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class phpbb_db_migration_data_style_update_p2 extends phpbb_db_migration
|
|||
{
|
||||
return array(
|
||||
'drop_columns' => array(
|
||||
STYLES_TABLE => array(
|
||||
$this->table_prefix . 'styles' => array(
|
||||
'imageset_id',
|
||||
'template_id',
|
||||
'theme_id',
|
||||
|
@ -26,17 +26,99 @@ class phpbb_db_migration_data_style_update_p2 extends phpbb_db_migration
|
|||
),
|
||||
|
||||
'drop_tables' => array(
|
||||
STYLES_IMAGESET_TABLE,
|
||||
STYLES_IMAGESET_DATA_TABLE,
|
||||
STYLES_TEMPLATE_TABLE,
|
||||
STYLES_TEMPLATE_DATA_TABLE,
|
||||
STYLES_THEME_TABLE,
|
||||
$this->table_prefix . 'styles_imageset',
|
||||
$this->table_prefix . 'styles_imageset_data',
|
||||
$this->table_prefix . 'styles_template',
|
||||
$this->table_prefix . 'styles_template_data',
|
||||
$this->table_prefix . 'styles_theme',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
public function revert_schema()
|
||||
{
|
||||
return array();
|
||||
return array(
|
||||
'add_columns' => array(
|
||||
$this->table_prefix . 'styles' => array(
|
||||
'imageset_id' => array('UINT', 0),
|
||||
'template_id' => array('UINT', 0),
|
||||
'theme_id' => array('UINT', 0),
|
||||
),
|
||||
),
|
||||
|
||||
'add_tables' => array(
|
||||
$this->table_prefix . 'styles_imageset' => array(
|
||||
'COLUMNS' => array(
|
||||
'imageset_id' => array('UINT', NULL, 'auto_increment'),
|
||||
'imageset_name' => array('VCHAR_UNI:255', ''),
|
||||
'imageset_copyright' => array('VCHAR_UNI', ''),
|
||||
'imageset_path' => array('VCHAR:100', ''),
|
||||
),
|
||||
'PRIMARY_KEY' => 'imageset_id',
|
||||
'KEYS' => array(
|
||||
'imgset_nm' => array('UNIQUE', 'imageset_name'),
|
||||
),
|
||||
),
|
||||
$this->table_prefix . 'styles_imageset_data' => array(
|
||||
'COLUMNS' => array(
|
||||
'image_id' => array('UINT', NULL, 'auto_increment'),
|
||||
'image_name' => array('VCHAR:200', ''),
|
||||
'image_filename' => array('VCHAR:200', ''),
|
||||
'image_lang' => array('VCHAR:30', ''),
|
||||
'image_height' => array('USINT', 0),
|
||||
'image_width' => array('USINT', 0),
|
||||
'imageset_id' => array('UINT', 0),
|
||||
),
|
||||
'PRIMARY_KEY' => 'image_id',
|
||||
'KEYS' => array(
|
||||
'i_d' => array('INDEX', 'imageset_id'),
|
||||
),
|
||||
),
|
||||
$this->table_prefix . 'styles_template' => array(
|
||||
'COLUMNS' => array(
|
||||
'template_id' => array('UINT', NULL, 'auto_increment'),
|
||||
'template_name' => array('VCHAR_UNI:255', ''),
|
||||
'template_copyright' => array('VCHAR_UNI', ''),
|
||||
'template_path' => array('VCHAR:100', ''),
|
||||
'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
|
||||
'template_storedb' => array('BOOL', 0),
|
||||
'template_inherits_id' => array('UINT:4', 0),
|
||||
'template_inherit_path' => array('VCHAR', ''),
|
||||
),
|
||||
'PRIMARY_KEY' => 'template_id',
|
||||
'KEYS' => array(
|
||||
'tmplte_nm' => array('UNIQUE', 'template_name'),
|
||||
),
|
||||
),
|
||||
$this->table_prefix . 'styles_template_data' => array(
|
||||
'COLUMNS' => array(
|
||||
'template_id' => array('UINT', 0),
|
||||
'template_filename' => array('VCHAR:100', ''),
|
||||
'template_included' => array('TEXT', ''),
|
||||
'template_mtime' => array('TIMESTAMP', 0),
|
||||
'template_data' => array('MTEXT_UNI', ''),
|
||||
),
|
||||
'KEYS' => array(
|
||||
'tid' => array('INDEX', 'template_id'),
|
||||
'tfn' => array('INDEX', 'template_filename'),
|
||||
),
|
||||
),
|
||||
$this->table_prefix . 'styles_theme' => array(
|
||||
'COLUMNS' => array(
|
||||
'theme_id' => array('UINT', NULL, 'auto_increment'),
|
||||
'theme_name' => array('VCHAR_UNI:255', ''),
|
||||
'theme_copyright' => array('VCHAR_UNI', ''),
|
||||
'theme_path' => array('VCHAR:100', ''),
|
||||
'theme_storedb' => array('BOOL', 0),
|
||||
'theme_mtime' => array('TIMESTAMP', 0),
|
||||
'theme_data' => array('MTEXT_UNI', ''),
|
||||
),
|
||||
'PRIMARY_KEY' => 'theme_id',
|
||||
'KEYS' => array(
|
||||
'theme_name' => array('UNIQUE', 'theme_name'),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class phpbb_db_migration_data_timezone extends phpbb_db_migration
|
|||
{
|
||||
return array(
|
||||
'change_columns' => array(
|
||||
USERS_TABLE => array(
|
||||
$this->table_prefix . 'users' => array(
|
||||
'user_timezone' => array('VCHAR:100', ''),
|
||||
),
|
||||
),
|
||||
|
@ -36,13 +36,13 @@ class phpbb_db_migration_data_timezone extends phpbb_db_migration
|
|||
{
|
||||
// Update user timezones
|
||||
$sql = 'SELECT user_dst, user_timezone
|
||||
FROM ' . USERS_TABLE . '
|
||||
FROM ' . $this->table_prefix . 'users
|
||||
GROUP BY user_timezone, user_dst';
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||
$sql = 'UPDATE ' . $this->table_prefix . "users
|
||||
SET user_timezone = '" . $this->db->sql_escape($this->convert_phpbb30_timezone($row['user_timezone'], $row['user_dst'])) . "'
|
||||
WHERE user_timezone = '" . $this->db->sql_escape($row['user_timezone']) . "'
|
||||
AND user_dst = " . (int) $row['user_dst'];
|
||||
|
@ -51,13 +51,10 @@ class phpbb_db_migration_data_timezone extends phpbb_db_migration
|
|||
$this->db->sql_freeresult($result);
|
||||
|
||||
// Update board default timezone
|
||||
$sql = 'UPDATE ' . CONFIG_TABLE . "
|
||||
$sql = 'UPDATE ' . $this->table_prefix . "config
|
||||
SET config_value = '" . $this->convert_phpbb30_timezone($this->config['board_timezone'], $this->config['board_dst']) . "'
|
||||
WHERE config_name = 'board_timezone'";
|
||||
$this->sql_query($sql);
|
||||
|
||||
// After we have calculated the timezones we can delete user_dst column from user table.
|
||||
$this->db_tools->sql_column_remove(USERS_TABLE, 'user_dst');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
38
phpBB/includes/db/migration/data/timezone_p2.php
Normal file
38
phpBB/includes/db/migration/data/timezone_p2.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_data_timezone_p2 extends phpbb_db_migration
|
||||
{
|
||||
public function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_data_timezone');
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'users' => array(
|
||||
'user_dst',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'add_columns' => array(
|
||||
$this->table_prefix . 'users' => array(
|
||||
'user_dst' => array('BOOL', 0),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue