Bump migration timestamps after 4.89.2 cherry-picks - #49849
Conversation
The 4.89.2 patch RC (rc-patch-fleet-v4.89.2) received two cherry-picks that carry DB migrations: - #48664 20260702164518_DedupeWindowsProgramTitlesFromUpgradeCode - #49515 20260717152653_FixInstallStatusPrecedence This makes 20260717152653 the newest (max) applied migration in 4.89.2. But on main/4.90 there are 11 migrations with timestamps *earlier* than 20260717152653 that are not present in 4.89.2: 20260704213830 DropWindowsMDMCommandResultsCommandUUIDForeignKey 20260706174522 ReparseWindowsHostCertificates 20260707071142 AddWindowsMDMConfigProfilesPriorContent 20260707140752 AddDDMAssetsTable 20260708153912 FixEmbeddedBundleTitleNames 20260708185958 CreateApplePSSOTables 20260708190008 AddPSSODeviceRegistrationTokenFleetVar 20260708192536 AddNanoQueueNextCommandIndex 20260713115453 CreateHostMDMAppleDeviceNames 20260715144547 CustomHostVitals 20260715214831 MultipleCustomPackagesPerTitle A database upgraded through 4.89.2 records 20260717152653 as its max applied migration, so on upgrade to 4.90 those 11 would be out-of-order. Bump them so they sort after the current newest migration (20260721160351), preserving their relative order. Schema DDL is unchanged (schema.sql differs only in the migration_status_tables version list). To be cherry-picked into rc-minor-fleet-v4.90.0.
There was a problem hiding this comment.
Pull request overview
This PR updates Fleet’s MySQL migration ordering on main/4.90 by bumping the timestamps (filenames + Up_/Down_ function names) of 11 migrations so they sort after migrations that were cherry-picked into the 4.89.2 patch RC, preventing out-of-order upgrades when moving a database from 4.89.2 → 4.90.
Changes:
- Bumped 11 migration timestamps to
20260723181401–20260723181411while preserving their relative order. - Updated the corresponding
MigrationClient.AddMigration(...)registrations andUp_/Down_function names. - Regenerated
server/datastore/mysql/schema.sqlmigration version list to reflect the bumped versions.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| server/datastore/mysql/schema.sql | Updates migration_status_tables seed data to replace the old 11 timestamps with the bumped versions (ordering fix only). |
| server/datastore/mysql/migrations/tables/20260723181401_DropWindowsMDMCommandResultsCommandUUIDForeignKey.go | Renames migration registration and Up_/Down_ symbols to the bumped timestamp. |
| server/datastore/mysql/migrations/tables/20260723181402_ReparseWindowsHostCertificates.go | Renames migration registration and Up_/Down_ symbols (and the Up_... comment) to the bumped timestamp. |
| server/datastore/mysql/migrations/tables/20260723181402_ReparseWindowsHostCertificates_test.go | Renames the test function to match the bumped migration Up_ name. |
| server/datastore/mysql/migrations/tables/20260723181403_AddWindowsMDMConfigProfilesPriorContent.go | Renames migration registration and Up_/Down_ symbols to the bumped timestamp. |
| server/datastore/mysql/migrations/tables/20260723181403_AddWindowsMDMConfigProfilesPriorContent_test.go | Renames the test function to match the bumped migration Up_ name. |
| server/datastore/mysql/migrations/tables/20260723181404_AddDDMAssetsTable.go | Renames migration registration and Up_/Down_ symbols to the bumped timestamp. |
| server/datastore/mysql/migrations/tables/20260723181404_AddDDMAssetsTable_test.go | Renames the test function to match the bumped migration Up_ name. |
| server/datastore/mysql/migrations/tables/20260723181405_FixEmbeddedBundleTitleNames.go | Renames migration registration and Up_/Down_ symbols to the bumped timestamp. |
| server/datastore/mysql/migrations/tables/20260723181405_FixEmbeddedBundleTitleNames_test.go | Renames the test function to match the bumped migration Up_ name. |
| server/datastore/mysql/migrations/tables/20260723181406_CreateApplePSSOTables.go | Renames migration registration and Up_/Down_ symbols to the bumped timestamp. |
| server/datastore/mysql/migrations/tables/20260723181406_CreateApplePSSOTables_test.go | Renames the test function to match the bumped migration Up_ name. |
| server/datastore/mysql/migrations/tables/20260723181407_AddPSSODeviceRegistrationTokenFleetVar.go | Renames migration registration and Up_/Down_ symbols to the bumped timestamp. |
| server/datastore/mysql/migrations/tables/20260723181407_AddPSSODeviceRegistrationTokenFleetVar_test.go | Renames the test function to match the bumped migration Up_ name. |
| server/datastore/mysql/migrations/tables/20260723181408_AddNanoQueueNextCommandIndex.go | Renames migration registration and Up_/Down_ symbols to the bumped timestamp. |
| server/datastore/mysql/migrations/tables/20260723181408_AddNanoQueueNextCommandIndex_test.go | Renames the test function to match the bumped migration Up_ name. |
| server/datastore/mysql/migrations/tables/20260723181409_CreateHostMDMAppleDeviceNames.go | Renames migration registration and Up_/Down_ symbols to the bumped timestamp. |
| server/datastore/mysql/migrations/tables/20260723181410_CustomHostVitals.go | Renames migration registration and Up_/Down_ symbols to the bumped timestamp. |
| server/datastore/mysql/migrations/tables/20260723181410_CustomHostVitals_test.go | Renames the test function to match the bumped migration Up_ name. |
| server/datastore/mysql/migrations/tables/20260723181411_MultipleCustomPackagesPerTitle.go | Renames migration registration and Up_/Down_ symbols to the bumped timestamp. |
| server/datastore/mysql/migrations/tables/20260723181411_MultipleCustomPackagesPerTitle_test.go | Renames the test function to match the bumped migration Up_ name. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (21)
WalkthroughThe MySQL migrations from Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
**Related issue:** N/A — release-engineering fix for migration forward-compatibility ## Summary Cherry-pick of #49849 into `rc-minor-fleet-v4.90.0`. The 4.89.2 patch RC received two cherry-picks carrying DB migrations (#48664 `DedupeWindowsProgramTitlesFromUpgradeCode`, #49515 `FixInstallStatusPrecedence`), making `20260717152653` the newest applied migration in 4.89.2. This 4.90 RC contains 11 migrations with timestamps **earlier** than `20260717152653` that are not in 4.89.2, so a database upgraded through 4.89.2 (max applied = `20260717152653`) would encounter them out-of-order when upgrading to 4.90: ``` 20260704213830 DropWindowsMDMCommandResultsCommandUUIDForeignKey 20260706174522 ReparseWindowsHostCertificates 20260707071142 AddWindowsMDMConfigProfilesPriorContent 20260707140752 AddDDMAssetsTable 20260708153912 FixEmbeddedBundleTitleNames 20260708185958 CreateApplePSSOTables 20260708190008 AddPSSODeviceRegistrationTokenFleetVar 20260708192536 AddNanoQueueNextCommandIndex 20260713115453 CreateHostMDMAppleDeviceNames 20260715144547 CustomHostVitals 20260715214831 MultipleCustomPackagesPerTitle ``` These are bumped to `20260723181401`–`20260723181411` (after `20260717152653`), preserving relative order and matching the timestamps used on `main` in #49849 so the two lines stay consistent. `schema.sql` was regenerated against this RC's migration set; DDL is unchanged (only the `migration_status_tables` version list differs). This RC does not include `20260721090128` / `20260721160351` (they are not part of 4.90), so those are intentionally absent from the regenerated schema. # Checklist for submitter - [x] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters. ## Testing - [x] QA'd all new/changed functionality manually Migrations replay cleanly in the new order via `make dump-test-schema`; regenerated `schema.sql` differs only in the `migration_status_tables` INSERT (table definitions byte-identical). ## Database migrations - [x] Checked schema for all modified table for columns that will auto-update timestamps during migration. - [x] Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects. - [x] Ensured the correct collation is explicitly set for character columns (`COLLATE utf8mb4_unicode_ci`). _No migration logic was changed — only timestamps/filenames were bumped to fix ordering._ Co-authored-by: test <test@test.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #49849 +/- ##
=======================================
Coverage 67.90% 67.91%
=======================================
Files 3905 3905
Lines 249645 249669 +24
Branches 13339 13339
=======================================
+ Hits 169532 169564 +32
+ Misses 64837 64832 -5
+ Partials 15276 15273 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Related issue: N/A — release-engineering fix for migration forward-compatibility
Summary
The 4.89.2 patch RC (
rc-patch-fleet-v4.89.2) received two cherry-picks that carry DB migrations:20260702164518_DedupeWindowsProgramTitlesFromUpgradeCode20260717152653_FixInstallStatusPrecedenceThis makes
20260717152653the newest (max) applied migration in 4.89.2. Onmain/4.90, there are 11 migrations with timestamps earlier than20260717152653that do not exist in 4.89.2:A database upgraded through 4.89.2 records
20260717152653as its max applied migration, so upgrading to 4.90 would attempt to run those 11 out-of-order. This bumps them to sort after the current newest migration (20260721160351), preserving their relative order — the same procedure as #48617 ("Bump migration timestamps after 4.88 cherry-pick").Schema DDL is unchanged:
schema.sqldiffers only in themigration_status_tablesversion list.This PR must be cherry-picked into
rc-minor-fleet-v4.90.0after merge.Checklist for submitter
SELECT *is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.Testing
Migrations replay cleanly in the new order via
make dump-test-schema; the regeneratedschema.sqldiffers frommainonly in themigration_status_tablesINSERT (table definitions are byte-identical), confirming the reorder does not change the resulting schema.Database migrations
COLLATE utf8mb4_unicode_ci).No migration logic was changed — only timestamps/filenames were bumped to fix ordering.
Summary by CodeRabbit
New Features
Bug Fixes