[feature/soft-delete] Update posts and topics table with database_update.php

PHPBB3-9657
This commit is contained in:
Joas Schilling 2012-08-29 19:11:33 +02:00
parent 8a036fa3e4
commit 36c9f6aa87

View file

@ -1102,17 +1102,23 @@ function database_update_info()
GROUPS_TABLE => array(
'group_teampage' => array('UINT', 0, 'after' => 'group_legend'),
),
POSTS_TABLE => array(
'post_visibility' => array('TINT:3', 0),
),
PROFILE_FIELDS_TABLE => array(
'field_show_on_pm' => array('BOOL', 0),
),
REPORTS_TABLE => array(
'reported_post_text' => array('MTEXT_UNI', ''),
),
STYLES_TABLE => 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(
'reported_post_text' => array('MTEXT_UNI', ''),
TOPICS_TABLE => array(
'topic_visibility' => array('TINT:3', 0),
),
),
'change_columns' => array(
@ -1123,6 +1129,18 @@ function database_update_info()
'user_timezone' => array('VCHAR:100', ''),
),
),
'drop_keys' => array(
TOPICS_TABLE => array('forum_appr_last'),
),
'add_index' => array(
POSTS_TABLE => array(
'post_visibility' => array('post_visibility'),
),
TOPICS_TABLE => array(
'topic_visibility' => array('topic_visibility'),
'forum_appr_last' => array('INDEX', array('forum_id', 'topic_visibility', 'topic_last_post_id')),
),
),
),
);
}
@ -2666,6 +2684,26 @@ function change_database_data(&$no_updates, $version)
$db_tools->sql_column_remove(USERS_TABLE, 'user_dst');
}
// If the column exists, we did not yet update the post visibility status
if ($db_tools->sql_column_exists(POSTS_TABLE, 'post_approved'))
{
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_visibility = post_approved';
_sql($sql, $errored, $error_ary);
$db_tools->sql_column_remove(POSTS_TABLE, 'post_approved');
}
// If the column exists, we did not yet update the topic visibility status
if ($db_tools->sql_column_exists(TOPICS_TABLE, 'topic_approved'))
{
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_visibility = topic_approved';
_sql($sql, $errored, $error_ary);
$db_tools->sql_column_remove(TOPICS_TABLE, 'topic_approved');
}
break;
}
}