Bump out-of-order migrations not included in v4.90.0 (#50690)

<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->

Two migrations merged to `main` were not included in the v4.90.0 release
but have timestamps older than
`20260723181411_MultipleCustomPackagesPerTitle` (the latest migration
shipped in v4.90.0). Databases already on v4.90.0 would never apply
them, since goose only runs migrations newer than the current (highest
applied) version.

Bumped both to current timestamps via `tools/bump-migration`:

- `20260721090128_AddTokenInvalidToABMTokens` →
`20260806154139_AddTokenInvalidToABMTokens`
- `20260721160351_AddHostMDMWindowsProfilesStatus` →
`20260806154150_AddHostMDMWindowsProfilesStatus`

No schema or logic changes — only the file names,
`Up_`/`Down_`/`TestUp_` function names, and the regenerated `schema.sql`
(`migration_status_tables` versions). Verified that none of the other
unreleased migrations (20260724+) depend on the schema these two create,
so applying them last is safe.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

## Testing

- [x] Added/updated automated tests (existing migration tests renamed
and re-run against MySQL)

## 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`).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Database Updates**
  - Added support for tracking whether ABM tokens are invalid.
- Added Windows MDM profile status tracking and backfilled existing
records.
- **Maintenance**
- Updated database migration identifiers and status records to ensure
migrations are applied consistently.
- **Tests**
- Updated migration verification tests to match the revised migration
identifiers.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Lucas Manuel Rodriguez
2026-08-07 08:40:19 -03:00
committed by GitHub
parent 25cfac309c
commit 3de43c84af
5 changed files with 10 additions and 10 deletions
@@ -6,16 +6,16 @@ import (
)
func init() {
MigrationClient.AddMigration(Up_20260721090128, Down_20260721090128)
MigrationClient.AddMigration(Up_20260806154139, Down_20260806154139)
}
func Up_20260721090128(tx *sql.Tx) error {
func Up_20260806154139(tx *sql.Tx) error {
if _, err := tx.Exec(`ALTER TABLE abm_tokens ADD COLUMN token_invalid TINYINT(1) NOT NULL DEFAULT '0'`); err != nil {
return fmt.Errorf("adding token_invalid column to abm_tokens table: %w", err)
}
return nil
}
func Down_20260721090128(tx *sql.Tx) error {
func Down_20260806154139(tx *sql.Tx) error {
return nil
}
@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestUp_20260721090128(t *testing.T) {
func TestUp_20260806154139(t *testing.T) {
db := applyUpToPrev(t)
// Insert a row before the migration to verify existing rows get the correct default.
@@ -6,12 +6,12 @@ import (
)
func init() {
MigrationClient.AddMigration(Up_20260721160351, Down_20260721160351)
MigrationClient.AddMigration(Up_20260806154150, Down_20260806154150)
}
// Up_20260721160351 creates host_mdm_windows_profiles_status, a per-host rollup of the aggregate Windows configuration-profile
// Up_20260806154150 creates host_mdm_windows_profiles_status, a per-host rollup of the aggregate Windows configuration-profile
// delivery status. It materializes exactly one bucket per host ('failed'|'pending'|'verifying'|'verified'|empty)
func Up_20260721160351(tx *sql.Tx) error {
func Up_20260806154150(tx *sql.Tx) error {
if _, err := tx.Exec(`
CREATE TABLE host_mdm_windows_profiles_status (
host_uuid VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL,
@@ -48,6 +48,6 @@ GROUP BY hmwp.host_uuid`); err != nil {
return nil
}
func Down_20260721160351(tx *sql.Tx) error {
func Down_20260806154150(tx *sql.Tx) error {
return nil
}
@@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestUp_20260721160351(t *testing.T) {
func TestUp_20260806154150(t *testing.T) {
db := applyUpToPrev(t)
// insertProfile adds one host_mdm_windows_profiles row. status is passed as a *string so we can exercise the NULL-as-pending
File diff suppressed because one or more lines are too long