Diễn tập nâng cấp trên bản sao (kết quả thật)
Lấy CSDL của hệ thống 6.3.4 đang chạy, nạp vào một schema riêng trên máy chủ 8.8.0 rồi chạy php artisan migrate --force. Dữ liệu mẫu nhỏ (40 tài sản, 19 người dùng) nên chỉ kiểm tra được tính tương thích của các bước cập nhật; thời gian và dữ liệu thật của đơn vị sẽ đo ở buổi vận hành thử. Thực hiện lúc 11/10/2026 14:17.
117/117
bước cập nhật hoàn thành
bước cập nhật hoàn thành
0m3.226s
thời gian chạy
thời gian chạy
migrate (thực đo)0
dòng báo lỗi
dòng báo lỗi
50 → 61
bảng
bảng
Các bước đã làm
| Bước | Lệnh / kết quả |
|---|---|
| 1. Sao CSDL bản 6.3.4 | mysqldump --single-transaction, 193,481 byte, nạp vào schema snipeit_upgrade_demo trong 0.8 giây |
| 2. Trạng thái trước | 371 bước đã chạy, 50 bảng, 117 bước chờ (migrate:status) |
| 3. Chạy cập nhật | php artisan migrate --force trên máy chủ 8.8.0 (Laravel 12.68.0, PHP 8.3.6): 117 bước DONE, thời gian 0m3.226s, mã thoát 0 |
| 4. Trạng thái sau | 488 bước (lô 1: 371, lô 2: 117), 61 bảng |
| 5. Đối soát số dòng | Mọi bảng giữ nguyên số dòng, riêng bảng migrations tăng thêm 117 dòng (xem bảng dưới) |
| 6. Mở hệ thống trên bản sao | Snipe-IT 8.8.0 chạy trên bản sao đã nâng cấp |
Nhật ký chạy cập nhật
Bấm để thu gọn hoặc mở rộng (125 dòng)
INFO Running migrations. 2018_08_08_100000_create_telescope_entries_table .............. 77.67ms DONE 2022_02_10_110210_add_company_id_to_locations ................. 18.26ms DONE 2023_02_27_092130_add_scope_locations_setting ................. 13.37ms DONE 2023_08_23_232739_create_report_templates_table ................ 9.67ms DONE 2024_03_18_164714_add_note_to_checkout_acceptance_table ....... 11.57ms DONE 2024_05_27_143554_add_parent_id_index_to_locations ............. 9.69ms DONE 2024_06_24_130348_add_profile_edit_to_settings ................ 14.18ms DONE 2024_07_04_103729_add_default_avatar_to_settings .............. 12.13ms DONE 2024_07_16_184145_add_deprecitation_type_to_depreciations_table 6.50ms DONE 2024_07_23_172032_change_no__n_o_to_nb__n_o .................... 5.18ms DONE 2024_07_26_143301_add_checkout_for_all_types_to_accessories ... 10.16ms DONE 2024_08_01_201721_add_required_notes_setting .................. 10.77ms DONE 2024_08_06_175114_add_shortcuts_enabled_to_settings_table ..... 13.04ms DONE 2024_08_07_204014_add_play_sounds_to_profile ................... 7.26ms DONE 2024_08_15_111816_add_confetti_to_users ....................... 12.50ms DONE 2024_08_16_104137_add_due_checkin_days_to_settings ............ 13.80ms DONE 2024_09_17_204302_change_user_id_to_created_by ............... 268.83ms DONE 2024_10_23_162301_add_manufacturer_id_model_number_to_consumables 9.72ms DONE 2024_10_31_212512_update_new_and_drop_old_barcode_settings .... 24.23ms DONE 2024_11_06_211457_add_manager_indexes_to_location_and_user .... 61.88ms DONE 2024_11_07_113631_improve_manager_indexes_on_users_and_locations 75.01ms DONE 2025_01_06_210534_change_report_templates_options_to_column_text_field 4.39ms DONE 2025_01_07_172419_fix_label_types_on_settings_table ........... 23.62ms DONE 2025_01_15_190348_adds_unavailable_to_license_seats_tables ..... 5.59ms DONE 2025_02_10_230155_add_notes_to_locations_companies_categories_manufacturers_groups 32.28ms DONE 2025_02_22_144518_add_checkin_checkout_to_customfields ........ 10.66ms DONE 2025_02_26_153413_add_ldap_invert_active_flag_to_setting_table 13.35ms DONE 2025_03_04_231256_purge_action_logs_of_report_template_activity 1.09ms DONE 2025_03_06_152922_copy_created_at_to_action_date_in_action_logs 17.97ms DONE 2025_03_12_184851_purge_action_logs_table_of_consumable_checkin_entries 0.40ms DONE 2025_04_02_113438_add_acceptance_pdf_logo_to_settings ......... 11.85ms DONE 2025_04_07_145418_add_custom_fields_to_audit ................... 6.97ms DONE 2025_04_22_170731_add_empty_row_count_to_settings_table ....... 11.22ms DONE 2025_05_12_183803_add_req_serial_bool_to_models_table .......... 4.69ms DONE 2025_05_20_190317_repopulate_webhook_selected_setting .......... 2.92ms DONE 2025_06_02_233556_add_admin_cc_always_to_settings_table ....... 11.43ms DONE 2025_06_03_000000_add_manager_view_enabled_to_settings_table .. 12.97ms DONE 2025_06_03_053438_fix_assigned_type_without_assigned_to ........ 0.46ms DONE 2025_06_04_101736_add_deleted_at_index_to_action_logs ......... 10.76ms DONE 2025_06_05_200518_add_alert_on_response_id_to_checkout_acceptances_table 13.12ms DONE 2025_06_05_204139_add_alert_on_response_to_categories_table .... 3.41ms DONE 2025_06_06_155058_make_supplier_id_nullable ................... 15.01ms DONE 2025_07_16_142036_clean_checkout_acceptances ................... 0.02ms DONE 2025_08_06_192954_add_image_to_maintenances .................... 4.70ms DONE 2025_08_10_111553_rename_title_to_name_on_asset_maintenances ... 3.99ms DONE 2025_08_10_113444_rename_asset_maintenances_to_maintenances .... 3.80ms DONE 2025_08_10_114135_change_asset_maintenance_in_logs_to_maintenance 1.47ms DONE 2025_08_11_181519_add_mobile_number_to_users_table ............ 13.93ms DONE 2025_08_12_225214_add_qty_to_checkout_acceptances_table ....... 14.83ms DONE 2025_08_19_114742_add_display_name_to_users .................... 7.40ms DONE 2025_08_19_122533_add_category_indexes ........................ 75.78ms DONE 2025_08_19_174823_add_display_name_to_ldap_settings ........... 91.10ms DONE 2025_08_20_190617_add_created_at_index_to_models .............. 11.73ms DONE 2025_09_16_104604_create_users_deleted_at_location_id_index ... 15.48ms DONE 2025_09_25_124321_add_external_id_to_groups ................... 11.34ms DONE 2025_10_07_113331_add_url_to_maintenances ...................... 5.51ms DONE 2025_10_13_102956_move_assetmodels_files ....................... 5.87ms DONE 2025_10_22_144927_migrate_incorrect_action_types ............... 0.52ms DONE 2025_11_04_173713_add_2d_label_prefix ......................... 14.76ms DONE 2025_11_10_205136_change_suppliers_notes_to_text .............. 15.79ms DONE 2025_11_10_211219_change_suppliers_notes_to_nullable .......... 21.34ms DONE 2025_11_13_160816_add_day_of_week_setting ..................... 12.99ms DONE 2025_11_14_150613_add_color_to_companies ...................... 27.76ms DONE 2025_11_18_193933_add_share_report_template_option ............ 10.28ms DONE 2025_11_28_175733_add_link_colors_to_settings ................. 62.49ms DONE 2025_12_10_211855_add_quantity_to_action_logs_table ............ 6.96ms DONE 2026_03_26_150316_add_deleted_at_to_companies .................. 5.94ms DONE 2026_03_27_000000_clean_checkout_acceptances ................... 8.79ms DONE 2026_04_07_141412_add_locations_parent_id_index ............... 12.16ms DONE 2026_04_07_141930_accessories_checkout_assigned_to_index ....... 7.75ms DONE 2026_04_20_200000_backfill_action_logs_company_id_from_item .... 0.41ms DONE 2026_04_28_001156_add_type_column_to_report_templates_table ... 10.14ms DONE 2026_05_05_125206_add_unique_index_to_nonces ................... 8.66ms DONE 2026_05_18_094309_add_maintenance_types_and_tracking_fields ... 44.70ms DONE 2026_05_19_000001_create_company_user_table ................... 36.34ms DONE 2026_06_10_000001_add_null_company_is_floater_to_settings ..... 11.35ms DONE 2026_06_22_000001_add_parent_id_to_companies_table ............ 13.91ms DONE 2026_06_23_000001_add_blocked_api_user_agents_to_settings ..... 41.99ms DONE 2026_06_30_000001_drop_company_name_unique_index ............... 4.10ms DONE 2026_07_01_000001_clear_unsafe_webhook_endpoints ............... 0.35ms DONE 2026_07_10_000001_rename_users_company_id_to_legacy_company_id . 8.19ms DONE 2026_07_17_000001_change_maintenance_dates_to_datetime ........ 26.76ms DONE 2026_07_17_000002_change_expected_checkin_to_datetime ......... 70.06ms DONE 2026_07_17_000003_widen_custom_fields_format_column ........... 16.11ms DONE 2026_07_21_000001_rename_completion_date_to_expected_completion_date 5.58ms DONE 2026_07_21_000002_change_maintenance_completed_at_to_datetime . 13.99ms DONE 2026_07_22_235215_restore_default_label_sizes_if_zeroed_in_settings_table 0.55ms DONE 2026_07_29_220000_make_departments_created_by_nullable ........ 15.28ms DONE 2026_07_30_000001_add_next_audit_date_index_to_assets ......... 12.05ms DONE 2026_08_03_141000_create_orders_and_order_items_tables ........ 71.28ms DONE 2026_08_03_142000_backfill_orders_from_inventory_tables ....... 78.17ms DONE 2026_08_03_143000_rename_order_number_to_legacy_on_inventory_tables 16.45ms DONE 2026_08_03_143500_snapshot_qty_to_legacy_qty_on_inventory_tables 19.55ms DONE 2026_08_03_144000_reconcile_inventory_qty_from_action_logs ..... 5.28ms DONE 2026_08_03_145000_add_composite_and_deleted_at_indexes_to_orders_tables 27.29ms DONE 2026_08_03_147000_rename_transaction_fields_to_legacy_on_inventory_tables 74.61ms DONE 2026_08_03_148000_repair_inventory_qty_below_in_use ............ 8.39ms DONE 2026_08_12_000000_add_processing_lock_columns_to_imports_table 31.59ms DONE 2026_08_13_000000_restore_clobbered_inventory_qty_from_legacy_snapshot 1.40ms DONE 2026_08_13_140000_add_tag_color_to_maintenance_types_table ..... 4.37ms DONE 2026_08_13_150000_add_item_type_and_rename_asset_id_on_maintenances_table 22.71ms DONE 2026_08_13_160000_create_calendar_events_table ................ 15.47ms DONE 2026_08_13_160100_backfill_calendar_events_from_existing_sources 348.51ms DONE 2026_08_13_170000_backfill_calendar_events_for_new_sources .... 81.23ms DONE 2026_08_14_170000_add_dashboard_widget_date_indexes ........... 60.71ms DONE 2026_08_20_000000_add_requestable_to_components_table .......... 9.14ms DONE 2026_08_20_010000_add_reservation_dates_to_checkout_requests .. 25.08ms DONE 2026_08_20_020000_add_requestable_to_licenses_table ............ 5.86ms DONE 2026_08_20_030000_add_notes_to_checkout_requests .............. 11.19ms DONE 2026_08_21_010000_add_state_machine_to_checkout_requests ...... 50.88ms DONE 2026_08_21_030000_add_fulfilled_quantity_to_checkout_requests . 14.95ms DONE 2026_08_24_010000_backfill_created_by_on_request_action_logs ... 0.45ms DONE 2026_08_24_234955_clean_stale_pending_acceptances .............. 1.11ms DONE 2026_09_16_183827_create_sync_adapter_tables .................. 85.32ms DONE 2026_09_21_140000_backfill_accessory_checkout_action_log_quantity 1.32ms DONE 2026_09_21_174908_add_action_type_created_at_composite_index_to_action_logs 12.89ms DONE 2026_09_22_201800_add_deleted_at_created_at_composite_index_to_assets 11.62ms DONE real 0m3.226s user 0m0.413s sys 0m0.111s
Đối soát số dòng: bản 6.3.4 và bản sao đã nâng cấp
| Bảng | Bản 6.3.4 | Bản sao sau nâng cấp | Kết luận | Mở |
|---|---|---|---|---|
| accessories | 8 | 8 | khớp | dữ liệu bản sao |
| accessories_users → accessories_checkout | 3 | 3 | khớp | dữ liệu bản sao |
| action_logs | 127 | 127 | khớp | dữ liệu bản sao |
| asset_external_sources | — | 0 | bảng mới, chưa có dữ liệu | dữ liệu bản sao |
| asset_logs | 0 | 0 | khớp | dữ liệu bản sao |
| asset_maintenances → maintenances | 6 | 6 | khớp | dữ liệu bản sao |
| asset_uploads | 0 | 0 | khớp | dữ liệu bản sao |
| assets | 40 | 40 | khớp | dữ liệu bản sao |
| calendar_events | — | 152 | bảng mới, tự điền 152 dòng | dữ liệu bản sao |
| categories | 9 | 9 | khớp | dữ liệu bản sao |
| checkout_acceptances | 0 | 0 | khớp | dữ liệu bản sao |
| checkout_requests | 0 | 0 | khớp | dữ liệu bản sao |
| companies | 1 | 1 | khớp | dữ liệu bản sao |
| company_user | — | 18 | bảng mới, tự điền 18 dòng | dữ liệu bản sao |
| components | 8 | 8 | khớp | dữ liệu bản sao |
| components_assets | 3 | 3 | khớp | dữ liệu bản sao |
| consumables | 8 | 8 | khớp | dữ liệu bản sao |
| consumables_users | 3 | 3 | khớp | dữ liệu bản sao |
| custom_field_custom_fieldset | 1 | 1 | khớp | dữ liệu bản sao |
| custom_fields | 1 | 1 | khớp | dữ liệu bản sao |
| custom_fieldsets | 1 | 1 | khớp | dữ liệu bản sao |
| departments | 4 | 4 | khớp | dữ liệu bản sao |
| depreciations | 1 | 1 | khớp | dữ liệu bản sao |
| imports | 0 | 0 | khớp | dữ liệu bản sao |
| kits | 0 | 0 | khớp | dữ liệu bản sao |
| kits_accessories | 0 | 0 | khớp | dữ liệu bản sao |
| kits_consumables | 0 | 0 | khớp | dữ liệu bản sao |
| kits_licenses | 0 | 0 | khớp | dữ liệu bản sao |
| kits_models | 0 | 0 | khớp | dữ liệu bản sao |
| license_seats | 155 | 155 | khớp | dữ liệu bản sao |
| licenses | 8 | 8 | khớp | dữ liệu bản sao |
| locations | 3 | 3 | khớp | dữ liệu bản sao |
| login_attempts | 461 | 254 | nhật ký đăng nhập, thay đổi liên tục | dữ liệu bản sao |
| maintenance_types | — | 8 | bảng mới, tự điền 8 dòng | dữ liệu bản sao |
| manufacturers | 8 | 8 | khớp | dữ liệu bản sao |
| migrations | 371 | 488 | +117 dòng | dữ liệu bản sao |
| models | 6 | 6 | khớp | dữ liệu bản sao |
| models_custom_fields | 0 | 0 | khớp | dữ liệu bản sao |
| oauth_access_tokens | 0 | 0 | khớp | dữ liệu bản sao |
| oauth_auth_codes | 0 | 0 | khớp | dữ liệu bản sao |
| oauth_clients | 2 | 2 | khớp | dữ liệu bản sao |
| oauth_personal_access_clients | 1 | 1 | khớp | dữ liệu bản sao |
| oauth_refresh_tokens | 0 | 0 | khớp | dữ liệu bản sao |
| order_items | — | 64 | bảng mới, tự điền 64 dòng | dữ liệu bản sao |
| orders | — | 28 | bảng mới, tự điền 28 dòng | dữ liệu bản sao |
| password_resets | 0 | 0 | khớp | dữ liệu bản sao |
| permission_groups | 0 | 0 | khớp | dữ liệu bản sao |
| report_templates | — | 0 | bảng mới, chưa có dữ liệu | dữ liệu bản sao |
| requested_assets | 0 | 0 | khớp | dữ liệu bản sao |
| requests | 0 | 0 | khớp | dữ liệu bản sao |
| saml_nonces | 0 | 0 | khớp | dữ liệu bản sao |
| settings | 1 | 1 | khớp | dữ liệu bản sao |
| status_labels | 7 | 7 | khớp | dữ liệu bản sao |
| suppliers | 1 | 1 | khớp | dữ liệu bản sao |
| sync_adapter_instances | — | 0 | bảng mới, chưa có dữ liệu | dữ liệu bản sao |
| telescope_entries | — | 0 | bảng mới, chưa có dữ liệu | dữ liệu bản sao |
| telescope_entries_tags | — | 0 | bảng mới, chưa có dữ liệu | dữ liệu bản sao |
| telescope_monitoring | — | 0 | bảng mới, chưa có dữ liệu | dữ liệu bản sao |
| throttle | 0 | 0 | khớp | dữ liệu bản sao |
| users | 19 | 19 | khớp | dữ liệu bản sao |
| users_groups | 0 | 0 | khớp | dữ liệu bản sao |
48/48 bảng dữ liệu của bản 6.3.4 giữ nguyên số dòng sau nâng cấp (không tính bảng
migrations, tăng thêm 117 dòng, và bảng nhật ký đăng nhập login_attempts, thay đổi liên tục khi hệ thống đang chạy).Phát hiện: hồ sơ bảo trì đã hoàn thành ở bản 6.3.4
Cần xử lý khi nâng cấp. Bước cập nhật
2026_07_21_000001_rename_completion_date_to_expected_completion_date đổi tên cột completion_date thành expected_completion_date (ngày dự kiến hoàn thành). Cột completed_at (ngày hoàn thành thực tế) là cột mới, để trống với dữ liệu cũ. Vì vậy hồ sơ đã hoàn thành ở bản 6.3.4 hiển thị chưa hoàn thành trên màn hình bản 8.8.0 cho đến khi được đánh dấu hoàn thành.Trước (bản 6.3.4): bảng asset_maintenances
| id | Tên | Loại | start_date | completion_date |
|---|---|---|---|---|
| 1 | HPC Demo — Thay pin laptop | Repair | 2026-10-01 | 2026-10-03 |
| 2 | HPC Demo — Nâng cấp SSD | Maintenance | 2026-10-01 | 2026-10-03 |
| 3 | HPC Demo — Vệ sinh máy tính | Maintenance | 2026-10-01 | 2026-10-03 |
| 4 | HPC Demo — Kiểm tra màn hình | Maintenance | 2026-10-01 | NULL |
| 5 | HPC Demo — Cập nhật phần mềm | Maintenance | 2026-10-01 | NULL |
| 6 | HPC Demo — Bảo trì định kỳ | Maintenance | 2026-10-01 | NULL |
Sau (bản sao đã nâng cấp): bảng maintenances
| id | Tên | Loại | maintenance_type_id | start_date | expected_completion_date | completed_at |
|---|---|---|---|---|---|---|
| 1 | HPC Demo — Thay pin laptop | Repair | 2 | 2026-10-01 00:00:00 | 2026-10-03 00:00:00 | NULL |
| 2 | HPC Demo — Nâng cấp SSD | Maintenance | 1 | 2026-10-01 00:00:00 | 2026-10-03 00:00:00 | NULL |
| 3 | HPC Demo — Vệ sinh máy tính | Maintenance | 1 | 2026-10-01 00:00:00 | 2026-10-03 00:00:00 | NULL |
| 4 | HPC Demo — Kiểm tra màn hình | Maintenance | 1 | 2026-10-01 00:00:00 | NULL | NULL |
| 5 | HPC Demo — Cập nhật phần mềm | Maintenance | 1 | 2026-10-01 00:00:00 | NULL | NULL |
| 6 | HPC Demo — Bảo trì định kỳ | Maintenance | 1 | 2026-10-01 00:00:00 | NULL | NULL |
Bản 6.3.4: bảng asset_maintenances Bản sao: bảng maintenances Truy vấn hồ sơ có ngày hoàn thành cũ nhưng completed_at trống Màn hình bảo trì trên bản sao
Đề xuất xử lý (chưa thực hiện): đơn vị quản lý tài sản xác nhận danh sách hồ sơ đã hoàn thành rồi cập nhật completed_at theo ngày hoàn thành cũ, hoặc đánh dấu hoàn thành trên màn hình.
Trước và sau trên một tài sản (HPC-DEMO-0001)
| id | asset_tag | Người tạo | expected_checkin | |
|---|---|---|---|---|
Bản 6.3.4 (cột user_id) | 1 | HPC-DEMO-0001 | 1 | NULL |
Bản sao (cột created_by) | 1 | HPC-DEMO-0001 | 1 | NULL |
Tài sản trên bản 6.3.4 Tài sản trên bản đã nâng cấp
Các phép kiểm tra dữ liệu
| Phép kiểm tra | Kết quả trên bản sao | Mở |
|---|---|---|
| Tài sản giao cho người dùng không tồn tại | 0 | chạy truy vấn |
| Đối soát số dòng tài sản, người dùng, lịch sử | 40 / 19 / 127 (bản 6.3.4: 40 / 19 / 127) | chạy truy vấn bản sao |