Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
)

func init() {
MigrationClient.AddMigration(Up_20260704213830, Down_20260704213830)
MigrationClient.AddMigration(Up_20260723181401, Down_20260723181401)
}

func Up_20260704213830(tx *sql.Tx) error {
func Up_20260723181401(tx *sql.Tx) error {
// windows_mdm_command_results is written on every Windows MDM check-in (MDMWindowsSaveResponse). During an active
// profile installation, tens of thousands of hosts insert result rows that all reference the same small set of shared
// command rows in windows_mdm_commands (one command per non-variable profile, fanned out to every host). The
Expand Down Expand Up @@ -45,6 +45,6 @@ func Up_20260704213830(tx *sql.Tx) error {
return nil
}

func Down_20260704213830(_ *sql.Tx) error {
func Down_20260723181401(_ *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
)

func init() {
MigrationClient.AddMigration(Up_20260706174522, Down_20260706174522)
MigrationClient.AddMigration(Up_20260723181402, Down_20260723181402)
}

// Up_20260706174522 soft-deletes existing osquery-origin Windows host certificate rows so they are re-ingested with
// Up_20260723181402 soft-deletes existing osquery-origin Windows host certificate rows so they are re-ingested with
// their distinguished name (subject/issuer) parsed from osquery's keyed subject2/issuer2 columns.
func Up_20260706174522(tx *sql.Tx) error {
func Up_20260723181402(tx *sql.Tx) error {
step := incrementalMigrationStep(countWindowsHostCertsToReparse, softDeleteWindowsHostCertsForReparse)
if err := step(tx); err != nil {
return fmt.Errorf("soft-deleting windows host certificates for re-parse: %w", err)
Expand Down Expand Up @@ -69,6 +69,6 @@ func softDeleteWindowsHostCertsForReparse(tx *sql.Tx, increment incrementCountFn
}
}

func Down_20260706174522(tx *sql.Tx) error {
func Down_20260723181402(tx *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
)

func TestUp_20260706174522(t *testing.T) {
func TestUp_20260723181402(t *testing.T) {
db := applyUpToPrev(t)

insertHost := func(platform, uuid string) uint {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
)

func init() {
MigrationClient.AddMigration(Up_20260707071142, Down_20260707071142)
MigrationClient.AddMigration(Up_20260723181403, Down_20260723181403)
}

func Up_20260707071142(tx *sql.Tx) error {
func Up_20260723181403(tx *sql.Tx) error {
// The profile-manager cron builds Windows <Delete> commands from the content of a profile version a host still has, but that
// content is gone from the live table once the profile is deleted (it was removed) or edited (it was overwritten).
//
Expand Down Expand Up @@ -57,6 +57,6 @@ func Up_20260707071142(tx *sql.Tx) error {
return nil
}

func Down_20260707071142(tx *sql.Tx) error {
func Down_20260723181403(tx *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
)

func TestUp_20260707071142(t *testing.T) {
func TestUp_20260723181403(t *testing.T) {
db := applyUpToPrev(t)

// Seed an in-flight deletion in the old pending-delete table; it must carry over to the new table.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
)

func init() {
MigrationClient.AddMigration(Up_20260707140752, Down_20260707140752)
MigrationClient.AddMigration(Up_20260723181404, Down_20260723181404)
}

func Up_20260707140752(tx *sql.Tx) error {
func Up_20260723181404(tx *sql.Tx) error {
_, err := tx.Exec(`
CREATE TABLE mdm_apple_declaration_assets (
asset_uuid varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
Expand Down Expand Up @@ -59,6 +59,6 @@ func Up_20260707140752(tx *sql.Tx) error {
return nil
}

func Down_20260707140752(tx *sql.Tx) error {
func Down_20260723181404(tx *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
)

func TestUp_20260707140752(t *testing.T) {
func TestUp_20260723181404(t *testing.T) {
db := applyUpToPrev(t)

// Apply current migration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
)

func init() {
MigrationClient.AddMigration(Up_20260708153912, Down_20260708153912)
MigrationClient.AddMigration(Up_20260723181405, Down_20260723181405)
}

var fixEmbeddedTrailingNonWordChars = regexp.MustCompile(`\W+$`)

func Up_20260708153912(tx *sql.Tx) error {
func Up_20260723181405(tx *sql.Tx) error {
fmaNames, err := fixEmbeddedLoadFMANamesDarwin(tx)
if err != nil {
return fmt.Errorf("loading FMA names: %w", err)
Expand Down Expand Up @@ -151,6 +151,6 @@ func fixEmbeddedLongestCommonPrefix(strs []string) string {
}
}

func Down_20260708153912(tx *sql.Tx) error {
func Down_20260723181405(tx *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
)

func TestUp_20260708153912(t *testing.T) {
func TestUp_20260723181405(t *testing.T) {
db := applyUpToPrev(t)

dataStmts := `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
)

func init() {
MigrationClient.AddMigration(Up_20260708185958, Down_20260708185958)
MigrationClient.AddMigration(Up_20260723181406, Down_20260723181406)
}

func Up_20260708185958(tx *sql.Tx) error {
func Up_20260723181406(tx *sql.Tx) error {
if _, err := tx.Exec(`
CREATE TABLE mdm_apple_psso_devices (
host_uuid VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL,
Expand Down Expand Up @@ -39,6 +39,6 @@ func Up_20260708185958(tx *sql.Tx) error {
return nil
}

func Down_20260708185958(tx *sql.Tx) error {
func Down_20260723181406(tx *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"
)

func TestUp_20260708185958(t *testing.T) {
func TestUp_20260723181406(t *testing.T) {
db := applyUpToPrev(t)
applyNext(t, db)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
)

func init() {
MigrationClient.AddMigration(Up_20260708190008, Down_20260708190008)
MigrationClient.AddMigration(Up_20260723181407, Down_20260723181407)
}

func Up_20260708190008(tx *sql.Tx) error {
func Up_20260723181407(tx *sql.Tx) error {
insStmt := `
INSERT INTO fleet_variables (
name, is_prefix, created_at
Expand All @@ -32,6 +32,6 @@ func Up_20260708190008(tx *sql.Tx) error {
return nil
}

func Down_20260708190008(tx *sql.Tx) error {
func Down_20260723181407(tx *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
)

func TestUp_20260708190008(t *testing.T) {
func TestUp_20260723181407(t *testing.T) {
db := applyUpToPrev(t)

var count int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
)

func init() {
MigrationClient.AddMigration(Up_20260708192536, Down_20260708192536)
MigrationClient.AddMigration(Up_20260723181408, Down_20260723181408)
}

func Up_20260708192536(tx *sql.Tx) error {
func Up_20260723181408(tx *sql.Tx) error {
// Supports RetrieveNextCommand, which filters a single enrollment's queue by
// (id, active) and orders by (priority DESC, created_at). Without an
// id-leading index the optimizer picks the global (priority DESC, created_at)
Expand All @@ -25,6 +25,6 @@ func Up_20260708192536(tx *sql.Tx) error {
}, tx)
}

func Down_20260708192536(tx *sql.Tx) error {
func Down_20260723181408(tx *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/assert"
)

func TestUp_20260708192536(t *testing.T) {
func TestUp_20260723181408(t *testing.T) {
db := applyUpToPrev(t)

assert.False(t, indexExists(db, "nano_enrollment_queue", "idx_neq_next_command"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
)

func init() {
MigrationClient.AddMigration(Up_20260713115453, Down_20260713115453)
MigrationClient.AddMigration(Up_20260723181409, Down_20260723181409)
}

func Up_20260713115453(tx *sql.Tx) error {
func Up_20260723181409(tx *sql.Tx) error {
// host_mdm_apple_device_names tracks the enforcement state of the host-name
// template for Apple hosts (macOS, iOS, iPadOS). A NULL status means the row
// is queued for the cron to pick up and send a Settings/DeviceName command.
Expand All @@ -36,6 +36,6 @@ CREATE TABLE host_mdm_apple_device_names (
return nil
}

func Down_20260713115453(tx *sql.Tx) error {
func Down_20260723181409(tx *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
)

func init() {
MigrationClient.AddMigration(Up_20260715144547, Down_20260715144547)
MigrationClient.AddMigration(Up_20260723181410, Down_20260723181410)
}

func Up_20260715144547(tx *sql.Tx) error {
func Up_20260723181410(tx *sql.Tx) error {
_, err := tx.Exec(`
CREATE TABLE custom_host_vitals (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
Expand Down Expand Up @@ -48,6 +48,6 @@ func Up_20260715144547(tx *sql.Tx) error {
return nil
}

func Down_20260715144547(tx *sql.Tx) error {
func Down_20260723181410(tx *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
)

func TestUp_20260715144547(t *testing.T) {
func TestUp_20260723181410(t *testing.T) {
db := applyUpToPrev(t)

// Seed a host so we can attach a per-host value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
)

func init() {
MigrationClient.AddMigration(Up_20260715214831, Down_20260715214831)
MigrationClient.AddMigration(Up_20260723181411, Down_20260723181411)
}

func Up_20260715214831(tx *sql.Tx) error {
func Up_20260723181411(tx *sql.Tx) error {
// A title can now hold several packages. dedup_token drives the new unique key. Custom
// rows resolve it to storage_id so they dedupe by content hash, letting different builds of
// one version coexist. FMA rows resolve it to version, leaving the per-version rows that
Expand Down Expand Up @@ -98,6 +98,6 @@ func Up_20260715214831(tx *sql.Tx) error {
return nil
}

func Down_20260715214831(tx *sql.Tx) error {
func Down_20260723181411(tx *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
)

func TestUp_20260715214831(t *testing.T) {
func TestUp_20260723181411(t *testing.T) {
db := applyUpToPrev(t)

insertTitle := func(name string, source string) int64 {
Expand Down
2 changes: 1 addition & 1 deletion server/datastore/mysql/schema.sql

Large diffs are not rendered by default.

Loading