Skip to content

Bump migration timestamps after 4.89.2 cherry-picks - #49849

Merged
georgekarrv merged 1 commit into
mainfrom
bump-migrations-after-4.89.2-cherry-picks
Jul 23, 2026
Merged

Bump migration timestamps after 4.89.2 cherry-picks#49849
georgekarrv merged 1 commit into
mainfrom
bump-migrations-after-4.89.2-cherry-picks

Conversation

@georgekarrv

@georgekarrv georgekarrv commented Jul 23, 2026

Copy link
Copy Markdown
Member

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:

PR Migration
#48664 20260702164518_DedupeWindowsProgramTitlesFromUpgradeCode
#49515 20260717152653_FixInstallStatusPrecedence

This makes 20260717152653 the newest (max) applied migration in 4.89.2. On main/4.90, there are 11 migrations with timestamps earlier than 20260717152653 that do not exist 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 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.sql differs only in the migration_status_tables version list.

This PR must be cherry-picked into rc-minor-fleet-v4.90.0 after merge.

Checklist for submitter

  • 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

  • QA'd all new/changed functionality manually

Migrations replay cleanly in the new order via make dump-test-schema; the regenerated schema.sql differs from main only in the migration_status_tables INSERT (table definitions are byte-identical), confirming the reorder does not change the resulting schema.

Database migrations

  • Checked schema for all modified table for columns that will auto-update timestamps during migration.
  • Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects.
  • 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.

Summary by CodeRabbit

  • New Features

    • Added support for Apple PSSO device and key management, including device registration configuration.
    • Added support for DDM assets, Apple device names, custom host vitals, and multiple custom packages per software title.
    • Improved Windows MDM profile content retention and certificate reprocessing.
    • Improved enrollment queue retrieval performance.
  • Bug Fixes

    • Corrected embedded software bundle title handling and removed an outdated Windows MDM relationship.
    • Updated database migration tracking and validation coverage.

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.
@georgekarrv
georgekarrv requested a review from a team as a code owner July 23, 2026 18:38
Copilot AI review requested due to automatic review settings July 23, 2026 18:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 2026072318140120260723181411 while preserving their relative order.
  • Updated the corresponding MigrationClient.AddMigration(...) registrations and Up_/Down_ function names.
  • Regenerated server/datastore/mysql/schema.sql migration 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.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f344f78c-092c-47b0-8cb2-9099a42a5ec5

📥 Commits

Reviewing files that changed from the base of the PR and between 375a03e and 7f6468d.

📒 Files selected for processing (21)
  • server/datastore/mysql/migrations/tables/20260723181401_DropWindowsMDMCommandResultsCommandUUIDForeignKey.go
  • server/datastore/mysql/migrations/tables/20260723181402_ReparseWindowsHostCertificates.go
  • server/datastore/mysql/migrations/tables/20260723181402_ReparseWindowsHostCertificates_test.go
  • server/datastore/mysql/migrations/tables/20260723181403_AddWindowsMDMConfigProfilesPriorContent.go
  • server/datastore/mysql/migrations/tables/20260723181403_AddWindowsMDMConfigProfilesPriorContent_test.go
  • server/datastore/mysql/migrations/tables/20260723181404_AddDDMAssetsTable.go
  • server/datastore/mysql/migrations/tables/20260723181404_AddDDMAssetsTable_test.go
  • server/datastore/mysql/migrations/tables/20260723181405_FixEmbeddedBundleTitleNames.go
  • server/datastore/mysql/migrations/tables/20260723181405_FixEmbeddedBundleTitleNames_test.go
  • server/datastore/mysql/migrations/tables/20260723181406_CreateApplePSSOTables.go
  • server/datastore/mysql/migrations/tables/20260723181406_CreateApplePSSOTables_test.go
  • server/datastore/mysql/migrations/tables/20260723181407_AddPSSODeviceRegistrationTokenFleetVar.go
  • server/datastore/mysql/migrations/tables/20260723181407_AddPSSODeviceRegistrationTokenFleetVar_test.go
  • server/datastore/mysql/migrations/tables/20260723181408_AddNanoQueueNextCommandIndex.go
  • server/datastore/mysql/migrations/tables/20260723181408_AddNanoQueueNextCommandIndex_test.go
  • server/datastore/mysql/migrations/tables/20260723181409_CreateHostMDMAppleDeviceNames.go
  • server/datastore/mysql/migrations/tables/20260723181410_CustomHostVitals.go
  • server/datastore/mysql/migrations/tables/20260723181410_CustomHostVitals_test.go
  • server/datastore/mysql/migrations/tables/20260723181411_MultipleCustomPackagesPerTitle.go
  • server/datastore/mysql/migrations/tables/20260723181411_MultipleCustomPackagesPerTitle_test.go
  • server/datastore/mysql/schema.sql

Walkthrough

The MySQL migrations from 20260723181401 through 20260723181411 are re-registered under new timestamped handler names. Their corresponding tests are renamed to target the updated migration identifiers. Existing migration SQL and assertions remain unchanged, including the nano enrollment queue index migration. The MySQL schema seed data is updated with revised migration_status_tables records.

Possibly related PRs

  • fleetdm/fleet#46097: Renumbers MySQL migration handlers and updates migration status seed rows.
  • fleetdm/fleet#48873: Updates migration handler registration and migration status seed entries.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the migration timestamp bump for cherry-picks.
Description check ✅ Passed The description follows the template well and includes the required summary, testing, and migration notes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bump-migrations-after-4.89.2-cherry-picks

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@georgekarrv
georgekarrv merged commit f75cd2e into main Jul 23, 2026
32 of 33 checks passed
@georgekarrv
georgekarrv deleted the bump-migrations-after-4.89.2-cherry-picks branch July 23, 2026 18:49
georgekarrv added a commit that referenced this pull request Jul 23, 2026
**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

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.91%. Comparing base (edccd24) to head (7f6468d).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...opWindowsMDMCommandResultsCommandUUIDForeignKey.go 66.66% 1 Missing ⚠️
...s/20260723181402_ReparseWindowsHostCertificates.go 66.66% 1 Missing ⚠️
...3181403_AddWindowsMDMConfigProfilesPriorContent.go 66.66% 1 Missing ⚠️
...rations/tables/20260723181404_AddDDMAssetsTable.go 66.66% 1 Missing ⚠️
...bles/20260723181405_FixEmbeddedBundleTitleNames.go 66.66% 1 Missing ⚠️
...ons/tables/20260723181406_CreateApplePSSOTables.go 66.66% 1 Missing ⚠️
...23181407_AddPSSODeviceRegistrationTokenFleetVar.go 66.66% 1 Missing ⚠️
...les/20260723181408_AddNanoQueueNextCommandIndex.go 66.66% 1 Missing ⚠️
...es/20260723181409_CreateHostMDMAppleDeviceNames.go 66.66% 1 Missing ⚠️
...grations/tables/20260723181410_CustomHostVitals.go 66.66% 1 Missing ⚠️
... and 1 more
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     
Flag Coverage Δ
backend 69.31% <66.66%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants