fleet/server/datastore/mysql/migrations/tables/20240613162201_AddMDMWindowsHostUUIDIndex.go
Roberto Dip b01389ad31
don't rely on MDM solution name to know if the host has Fleet MDM on (#19688)
for #18977

# Checklist for submitter

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

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-06-14 15:01:12 -03:00

25 lines
489 B
Go

package tables
import (
"database/sql"
"fmt"
)
func init() {
MigrationClient.AddMigration(Up_20240613162201, Down_20240613162201)
}
func Up_20240613162201(tx *sql.Tx) error {
_, err := tx.Exec(`
ALTER TABLE mdm_windows_enrollments
ADD INDEX idx_mdm_windows_enrollments_host_uuid (host_uuid)`,
)
if err != nil {
return fmt.Errorf("failed to add index to mdm_windows_enrollments.host_uuid: %w", err)
}
return nil
}
func Down_20240613162201(tx *sql.Tx) error {
return nil
}