#3317 - Database backups: columns out of order
| Identifier | #3317 |
|---|---|
| Issue type | Minor issue (breaks specific functionality) |
| Title | Database backups: columns out of order |
| Status | Closed (rejected) |
| Handling member | Chris Graham |
| Addon | backup |
| Description | When the backups system generates a database backup, it does not correctly order the columns in the create_table functions. This means when restoring a database backup, the columns could end up in a different order than what was originally designed according to composr installation. |
| Steps to reproduce | |
| Additional information | Example:
// $GLOBALS['SITE_DB']->create_table('f_members', array( // 'id' => '*AUTO', // 'm_allow_emails' => 'BINARY', // 'm_allow_emails_from_staff' => 'BINARY', // 'm_auto_mark_read' => 'BINARY', // 'm_auto_monitor_contrib_content' => 'BINARY', // 'm_avatar_url' => 'URLPATH', // 'm_cache_num_posts' => 'INTEGER', // 'm_cache_warnings' => 'INTEGER', // 'm_dob_day' => '?SHORT_INTEGER', // 'm_dob_month' => '?SHORT_INTEGER', // 'm_dob_year' => '?INTEGER', // 'm_email_address' => 'SHORT_TEXT', // 'm_highlighted_name' => 'BINARY', // 'm_ip_address' => 'IP', // 'm_is_perm_banned' => 'BINARY', // 'm_join_time' => 'TIME', // 'm_language' => 'ID_TEXT', // 'm_last_submit_time' => 'TIME', // 'm_last_visit_time' => 'TIME', // 'm_max_email_attach_size_mb' => 'INTEGER', // 'm_on_probation_until' => '?TIME', // 'm_password_change_code' => 'SHORT_TEXT', // 'm_password_compat_scheme' => 'ID_TEXT', // 'm_pass_hash_salted' => 'SHORT_TEXT', // 'm_pass_salt' => 'SHORT_TEXT', // 'm_photo_thumb_url' => 'URLPATH', // 'm_photo_url' => 'URLPATH', // 'm_preview_posts' => 'BINARY', // 'm_primary_group' => 'GROUP', // 'm_profile_views' => 'UINTEGER', // 'm_pt_allow' => 'SHORT_TEXT', // 'm_pt_rules_text' => 'LONG_TRANS__COMCODE', // 'm_reveal_age' => 'BINARY', // 'm_signature' => 'LONG_TRANS__COMCODE', // 'm_theme' => 'ID_TEXT', // 'm_timezone_offset' => 'SHORT_TEXT', // 'm_title' => 'SHORT_TEXT', // 'm_total_sessions' => 'UINTEGER', // 'm_username' => 'ID_TEXT', // 'm_validated' => 'BINARY', // 'm_validated_email_confirm_code' => 'SHORT_TEXT', // 'm_views_signatures' => 'BINARY'), true, false, null); Everything is ordered alphabetically in the restore_data.php file. However, this was not how the columns were ordered in the original Composr installation; for example, m_username comes after id. When you restore this, your columns will end up in the order above, rather than the original order from Composr's installation. |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Comments
All our insert queries use named keys, rather than assuming any ordering.