From c526fcfeac07bcbf3f9116352380c7a3c60e9233 Mon Sep 17 00:00:00 2001 From: Matias Spinarolli Date: Tue, 22 Sep 2026 11:11:55 -0300 Subject: [PATCH 1/7] Add description column to configuration profiles Stored for all four profile types and returned by list and get. Not part of any checksum or token, and the update paths leave uploaded_at alone on a description-only change, so editing it never re-delivers the profile. Setting it through the API, GitOps and the UI follows. Related issue: #51814 --- server/datastore/mysql/android.go | 27 ++- server/datastore/mysql/apple_mdm.go | 55 ++++-- server/datastore/mysql/mdm.go | 5 + server/datastore/mysql/mdm_test.go | 159 ++++++++++++++++++ server/datastore/mysql/microsoft_mdm.go | 27 ++- ...ddDescriptionToMDMConfigurationProfiles.go | 37 ++++ server/datastore/mysql/schema.sql | 8 +- server/fleet/android.go | 1 + server/fleet/apple_mdm.go | 7 + server/fleet/mdm.go | 10 +- server/fleet/windows_mdm.go | 1 + server/service/apple_mdm.go | 4 + server/service/mdm.go | 18 +- server/service/windows_mdm_profiles.go | 2 + 14 files changed, 323 insertions(+), 38 deletions(-) create mode 100644 server/datastore/mysql/migrations/tables/20260924203815_AddDescriptionToMDMConfigurationProfiles.go diff --git a/server/datastore/mysql/android.go b/server/datastore/mysql/android.go index 456c4f08985..e75fbd6b63d 100644 --- a/server/datastore/mysql/android.go +++ b/server/datastore/mysql/android.go @@ -832,8 +832,8 @@ func (ds *Datastore) NewMDMAndroidConfigProfile(ctx context.Context, cp fleet.MD profileUUID := fleet.MDMAndroidProfileUUIDPrefix + uuid.New().String() insertProfileStmt := ` INSERT INTO - mdm_android_configuration_profiles (profile_uuid, team_id, name, raw_json, uploaded_at) -(SELECT ?, ?, ?, ?, CURRENT_TIMESTAMP() FROM DUAL WHERE + mdm_android_configuration_profiles (profile_uuid, team_id, name, description, raw_json, uploaded_at) +(SELECT ?, ?, ?, ?, ?, CURRENT_TIMESTAMP() FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM mdm_apple_configuration_profiles WHERE name = ? AND team_id = ? ) AND NOT EXISTS ( @@ -849,7 +849,7 @@ INSERT INTO } err := ds.withTx(ctx, func(tx sqlx.ExtContext) error { - res, err := tx.ExecContext(ctx, insertProfileStmt, profileUUID, teamID, cp.Name, cp.RawJSON, cp.Name, teamID, cp.Name, teamID, cp.Name, teamID) + res, err := tx.ExecContext(ctx, insertProfileStmt, profileUUID, teamID, cp.Name, cp.Description, cp.RawJSON, cp.Name, teamID, cp.Name, teamID, cp.Name, teamID) if err != nil { switch { case IsDuplicate(err): @@ -913,13 +913,14 @@ INSERT INTO return &fleet.MDMAndroidConfigProfile{ ProfileUUID: profileUUID, Name: cp.Name, + Description: cp.Description, RawJSON: cp.RawJSON, TeamID: cp.TeamID, }, nil } func (ds *Datastore) GetMDMAndroidConfigProfile(ctx context.Context, profileUUID string) (*fleet.MDMAndroidConfigProfile, error) { - stmt := `SELECT profile_uuid, team_id, name, raw_json, auto_increment, created_at, uploaded_at FROM mdm_android_configuration_profiles WHERE profile_uuid = ?` + stmt := `SELECT profile_uuid, team_id, name, description, raw_json, auto_increment, created_at, uploaded_at FROM mdm_android_configuration_profiles WHERE profile_uuid = ?` var profile fleet.MDMAndroidConfigProfile err := sqlx.GetContext(ctx, ds.reader(ctx), &profile, stmt, profileUUID) if err != nil { @@ -981,8 +982,8 @@ func (ds *Datastore) UpdateMDMAndroidConfigProfile(ctx context.Context, cp fleet // the pre-update raw_json (SET evaluates left to right), and the // parameter must be CAST to JSON -- a json column never equals a // bare string. - stmt := `UPDATE mdm_android_configuration_profiles SET uploaded_at = IF(raw_json = CAST(? AS JSON), uploaded_at, CURRENT_TIMESTAMP()), raw_json = ? WHERE profile_uuid = ? AND name = ?` - res, err := tx.ExecContext(ctx, stmt, cp.RawJSON, cp.RawJSON, cp.ProfileUUID, cp.Name) + stmt := `UPDATE mdm_android_configuration_profiles SET uploaded_at = IF(raw_json = CAST(? AS JSON), uploaded_at, CURRENT_TIMESTAMP()), raw_json = ?, description = ? WHERE profile_uuid = ? AND name = ?` + res, err := tx.ExecContext(ctx, stmt, cp.RawJSON, cp.RawJSON, cp.Description, cp.ProfileUUID, cp.Name) if err != nil { return ctxerr.Wrap(ctx, err, "updating android mdm config profile contents") } @@ -999,6 +1000,14 @@ func (ds *Datastore) UpdateMDMAndroidConfigProfile(ctx context.Context, cp fleet }, "android", false); err != nil { return ctxerr.Wrap(ctx, err, "updating android profile variable associations") } + } else { + // Description is not part of the checksum, so it is written without + // touching uploaded_at. The row is known to exist from the SELECT above. + if _, err := tx.ExecContext(ctx, + `UPDATE mdm_android_configuration_profiles SET description = ? WHERE profile_uuid = ?`, + cp.Description, cp.ProfileUUID); err != nil { + return ctxerr.Wrap(ctx, err, "updating android mdm config profile description") + } } labels := make([]fleet.ConfigurationProfileLabel, 0, len(cp.LabelsIncludeAll)+len(cp.LabelsIncludeAny)+len(cp.LabelsExcludeAny)) @@ -2219,17 +2228,19 @@ WHERE profile_uuid, team_id, name, + description, raw_json, uploaded_at - ) VALUES (CONCAT('` + fleet.MDMAndroidProfileUUIDPrefix + `', CONVERT(uuid() USING utf8mb4)), ?, ?, ?, CURRENT_TIMESTAMP(6)) + ) VALUES (CONCAT('` + fleet.MDMAndroidProfileUUIDPrefix + `', CONVERT(uuid() USING utf8mb4)), ?, ?, ?, ?, CURRENT_TIMESTAMP(6)) ON DUPLICATE KEY UPDATE + description = VALUES(description), raw_json = VALUES(raw_json), name = VALUES(name), uploaded_at = IF(raw_json = VALUES(raw_json) AND name = VALUES(name), uploaded_at, CURRENT_TIMESTAMP(6)) ` for _, p := range profiles { var res sql.Result - if res, err = tx.ExecContext(ctx, insertNewOrEditedProfile, profileTeamID, p.Name, p.RawJSON); err != nil { + if res, err = tx.ExecContext(ctx, insertNewOrEditedProfile, profileTeamID, p.Name, p.Description, p.RawJSON); err != nil { return false, ctxerr.Wrap(ctx, err, "insert or update profile") } diff --git a/server/datastore/mysql/apple_mdm.go b/server/datastore/mysql/apple_mdm.go index e8b79ed20f8..61121b9266b 100644 --- a/server/datastore/mysql/apple_mdm.go +++ b/server/datastore/mysql/apple_mdm.go @@ -195,8 +195,8 @@ func (ds *Datastore) NewMDMAppleConfigProfile(ctx context.Context, cp fleet.MDMA stmt := ` INSERT INTO - mdm_apple_configuration_profiles (profile_uuid, team_id, identifier, name, scope, mobileconfig, checksum, uploaded_at, secrets_updated_at) -(SELECT ?, ?, ?, ?, ?, ?, UNHEX(MD5(?)), CURRENT_TIMESTAMP(), ? FROM DUAL WHERE + mdm_apple_configuration_profiles (profile_uuid, team_id, identifier, name, description, scope, mobileconfig, checksum, uploaded_at, secrets_updated_at) +(SELECT ?, ?, ?, ?, ?, ?, ?, UNHEX(MD5(?)), CURRENT_TIMESTAMP(), ? FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM mdm_windows_configuration_profiles WHERE name = ? AND team_id = ? ) AND NOT EXISTS ( @@ -218,7 +218,7 @@ INSERT INTO return err } res, err := tx.ExecContext(ctx, stmt, - profUUID, teamID, cp.Identifier, cp.Name, cp.Scope, cp.Mobileconfig, cp.Mobileconfig, cp.SecretsUpdatedAt, cp.Name, teamID, cp.Name, + profUUID, teamID, cp.Identifier, cp.Name, cp.Description, cp.Scope, cp.Mobileconfig, cp.Mobileconfig, cp.SecretsUpdatedAt, cp.Name, teamID, cp.Name, teamID, cp.Name, teamID) if err != nil { switch { @@ -285,6 +285,7 @@ INSERT INTO ProfileID: uint(profileID), //nolint:gosec // dismiss G115 Identifier: cp.Identifier, Name: cp.Name, + Description: cp.Description, Scope: cp.Scope, Mobileconfig: cp.Mobileconfig, TeamID: cp.TeamID, @@ -360,9 +361,9 @@ func (ds *Datastore) UpdateMDMAppleConfigProfile(ctx context.Context, cp fleet.M stmt := ` UPDATE mdm_apple_configuration_profiles SET uploaded_at = IF(checksum = UNHEX(MD5(?)) AND name = ?, uploaded_at, CURRENT_TIMESTAMP()), - mobileconfig = ?, checksum = UNHEX(MD5(?)), name = ?, secrets_updated_at = ? + mobileconfig = ?, checksum = UNHEX(MD5(?)), name = ?, description = ?, secrets_updated_at = ? WHERE profile_uuid = ? AND identifier = ?` - res, err := tx.ExecContext(ctx, stmt, cp.Mobileconfig, cp.Name, cp.Mobileconfig, cp.Mobileconfig, cp.Name, cp.SecretsUpdatedAt, cp.ProfileUUID, cp.Identifier) + res, err := tx.ExecContext(ctx, stmt, cp.Mobileconfig, cp.Name, cp.Mobileconfig, cp.Mobileconfig, cp.Name, cp.Description, cp.SecretsUpdatedAt, cp.ProfileUUID, cp.Identifier) if err != nil { switch { case IsDuplicate(err): @@ -374,6 +375,27 @@ WHERE profile_uuid = ? AND identifier = ?` if aff, _ := res.RowsAffected(); aff == 0 { return ctxerr.Wrap(ctx, notFound("MDMAppleConfigProfile").WithName(cp.ProfileUUID)) } + } else { + // Description is not part of the checksum, so it is written without + // touching uploaded_at: a bump would re-verify every installed copy. + res, err := tx.ExecContext(ctx, + `UPDATE mdm_apple_configuration_profiles SET description = ? WHERE profile_uuid = ?`, + cp.Description, cp.ProfileUUID) + if err != nil { + return ctxerr.Wrap(ctx, err, "updating apple mdm config profile description") + } + if aff, _ := res.RowsAffected(); aff == 0 { + // 0 rows also means "unchanged", so only fail when the row is gone. + var exists bool + if err := sqlx.GetContext(ctx, tx, &exists, + `SELECT EXISTS (SELECT 1 FROM mdm_apple_configuration_profiles WHERE profile_uuid = ?)`, + cp.ProfileUUID); err != nil { + return ctxerr.Wrap(ctx, err, "checking apple mdm config profile exists") + } + if !exists { + return ctxerr.Wrap(ctx, notFound("MDMAppleConfigProfile").WithName(cp.ProfileUUID)) + } + } } labels := make([]fleet.ConfigurationProfileLabel, 0, len(cp.LabelsIncludeAll)+len(cp.LabelsIncludeAny)+len(cp.LabelsExcludeAny)) @@ -520,6 +542,7 @@ SELECT profile_id, team_id, name, + description, scope, identifier, mobileconfig, @@ -587,6 +610,7 @@ SELECT declaration_uuid, team_id, name, + description, identifier, raw_json, scope, @@ -2945,16 +2969,17 @@ WHERE const insertNewOrEditedProfile = ` INSERT INTO mdm_apple_configuration_profiles ( - profile_uuid, team_id, identifier, name, scope, mobileconfig, checksum, uploaded_at, secrets_updated_at + profile_uuid, team_id, identifier, name, description, scope, mobileconfig, checksum, uploaded_at, secrets_updated_at ) VALUES -- see https://stackoverflow.com/a/51393124/1094941 - ( CONCAT('` + fleet.MDMAppleProfileUUIDPrefix + `', CONVERT(uuid() USING utf8mb4)), ?, ?, ?, ?, ?, UNHEX(MD5(mobileconfig)), CURRENT_TIMESTAMP(6), ?) + ( CONCAT('` + fleet.MDMAppleProfileUUIDPrefix + `', CONVERT(uuid() USING utf8mb4)), ?, ?, ?, ?, ?, ?, UNHEX(MD5(mobileconfig)), CURRENT_TIMESTAMP(6), ?) ON DUPLICATE KEY UPDATE uploaded_at = IF(checksum = VALUES(checksum) AND name = VALUES(name), uploaded_at, CURRENT_TIMESTAMP(6)), secrets_updated_at = VALUES(secrets_updated_at), checksum = VALUES(checksum), name = VALUES(name), + description = VALUES(description), mobileconfig = VALUES(mobileconfig) ` @@ -3048,7 +3073,7 @@ ON DUPLICATE KEY UPDATE // the profile did not change, its variables cannot have changed since the // contents is the same as it was already). for _, p := range incomingProfs { - if result, err = tx.ExecContext(ctx, insertNewOrEditedProfile, profTeamID, p.Identifier, p.Name, p.Scope, + if result, err = tx.ExecContext(ctx, insertNewOrEditedProfile, profTeamID, p.Identifier, p.Name, p.Description, p.Scope, p.Mobileconfig, p.SecretsUpdatedAt); err != nil { return false, ctxerr.Wrapf(ctx, err, "insert new/edited profile with identifier %q", p.Identifier) } @@ -5205,6 +5230,7 @@ INSERT INTO mdm_apple_declarations ( declaration_uuid, identifier, name, + description, raw_json, scope, secrets_updated_at, @@ -5212,12 +5238,13 @@ INSERT INTO mdm_apple_declarations ( team_id ) VALUES ( - ?,?,?,?,?,?,NOW(6),? + ?,?,?,?,?,?,?,NOW(6),? ) ON DUPLICATE KEY UPDATE uploaded_at = IF(raw_json = VALUES(raw_json) AND name = VALUES(name) AND IFNULL(secrets_updated_at = VALUES(secrets_updated_at), TRUE), uploaded_at, NOW(6)), secrets_updated_at = VALUES(secrets_updated_at), name = VALUES(name), + description = VALUES(description), identifier = VALUES(identifier), scope = VALUES(scope), raw_json = VALUES(raw_json) @@ -5236,6 +5263,7 @@ ON DUPLICATE KEY UPDATE declUUID, d.Identifier, d.Name, + d.Description, d.RawJSON, scope, d.SecretsUpdatedAt, @@ -5357,11 +5385,12 @@ INSERT INTO mdm_apple_declarations ( team_id, identifier, name, + description, raw_json, scope, secrets_updated_at, uploaded_at) -(SELECT ?,?,?,?,?,?,?,CURRENT_TIMESTAMP() FROM DUAL WHERE +(SELECT ?,?,?,?,?,?,?,?,CURRENT_TIMESTAMP() FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM mdm_windows_configuration_profiles WHERE name = ? AND team_id = ? ) AND NOT EXISTS ( @@ -5388,11 +5417,12 @@ INSERT INTO mdm_apple_declarations ( team_id, identifier, name, + description, raw_json, scope, secrets_updated_at, uploaded_at) -(SELECT ?,?,?,?,?,?,?,NOW(6) FROM DUAL WHERE +(SELECT ?,?,?,?,?,?,?,?,NOW(6) FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM mdm_windows_configuration_profiles WHERE name = ? AND team_id = ? ) AND NOT EXISTS ( @@ -5403,6 +5433,7 @@ INSERT INTO mdm_apple_declarations ( ) ON DUPLICATE KEY UPDATE identifier = VALUES(identifier), + description = VALUES(description), scope = VALUES(scope), uploaded_at = IF(raw_json = VALUES(raw_json) AND name = VALUES(name) AND IFNULL(secrets_updated_at = VALUES(secrets_updated_at), TRUE), uploaded_at, NOW(6)), raw_json = VALUES(raw_json)` @@ -5442,7 +5473,7 @@ func (ds *Datastore) insertOrUpsertMDMAppleDeclaration(ctx context.Context, insO err := ds.withTx(ctx, func(tx sqlx.ExtContext) error { res, err := tx.ExecContext(ctx, insOrUpsertStmt, - declUUID, tmID, declaration.Identifier, declaration.Name, declaration.RawJSON, + declUUID, tmID, declaration.Identifier, declaration.Name, declaration.Description, declaration.RawJSON, scope, declaration.SecretsUpdatedAt, declaration.Name, tmID, declaration.Name, tmID, declaration.Name, tmID) if err != nil { diff --git a/server/datastore/mysql/mdm.go b/server/datastore/mysql/mdm.go index 7f81d7669cb..e47468d49a4 100644 --- a/server/datastore/mysql/mdm.go +++ b/server/datastore/mysql/mdm.go @@ -767,6 +767,7 @@ SELECT profile_uuid, team_id, name, + description, scope, platform, identifier, @@ -778,6 +779,7 @@ FROM ( profile_uuid, team_id, name, + description, scope, 'darwin' as platform, identifier, @@ -796,6 +798,7 @@ FROM ( profile_uuid, team_id, name, + description, '' as scope, 'windows' as platform, '' as identifier, @@ -814,6 +817,7 @@ FROM ( declaration_uuid AS profile_uuid, team_id, name, + description, scope, 'darwin' AS platform, identifier, @@ -830,6 +834,7 @@ FROM ( profile_uuid, team_id, name, + description, '' AS scope, 'android' AS platform, '' AS identifier, diff --git a/server/datastore/mysql/mdm_test.go b/server/datastore/mysql/mdm_test.go index 457343877e9..6bdb66d72f2 100644 --- a/server/datastore/mysql/mdm_test.go +++ b/server/datastore/mysql/mdm_test.go @@ -51,6 +51,7 @@ func TestMDMShared(t *testing.T) { {"TestBatchSetMDMProfiles", testBatchSetMDMProfiles}, {"TestBatchSetMDMProfilesSoftwareUpdateTracking", testBatchSetMDMProfilesSoftwareUpdateTracking}, {"TestListMDMConfigProfiles", testListMDMConfigProfiles}, + {"TestMDMConfigProfilesDescription", testMDMConfigProfilesDescription}, {"TestGetHostMDMProfilesExpectedForVerification", testGetHostMDMProfilesExpectedForVerification}, {"TestBatchSetProfileLabelAssociations", testBatchSetProfileLabelAssociations}, {"TestMDMEULA", testMDMEULA}, @@ -1951,6 +1952,164 @@ type anyProfile struct { // Scoped to only the Windows hosts present in the want map so that rows // belonging to hosts not in the current assertion are left untouched. This // prevents implicitly hiding issues for hosts the test phase doesn't check. + +func testMDMConfigProfilesDescription(t *testing.T, ds *Datastore) { + ctx := t.Context() + opts := fleet.ListOptions{OrderKey: "name"} + + // create one profile of each type with a description + apple, err := ds.NewMDMAppleConfigProfile(ctx, fleet.MDMAppleConfigProfile{ + Name: "apple", + Identifier: "com.example.apple", + Description: "apple desc", + Mobileconfig: mobileconfig.Mobileconfig(""), + Scope: fleet.PayloadScopeSystem, + }, nil) + require.NoError(t, err) + require.Equal(t, "apple desc", apple.Description) + + decl := declForTest("decl", "decl", "decl") + decl.Description = "decl desc" + decl, err = ds.NewMDMAppleDeclaration(ctx, decl, nil) + require.NoError(t, err) + + win, err := ds.NewMDMWindowsConfigProfile(ctx, fleet.MDMWindowsConfigProfile{ + Name: "windows", + Description: "windows desc", + SyncML: []byte(""), + }, nil) + require.NoError(t, err) + require.Equal(t, "windows desc", win.Description) + + android := androidConfigProfileForTest(t, "android", nil) + android.Description = "android desc" + android, err = ds.NewMDMAndroidConfigProfile(ctx, *android, nil) + require.NoError(t, err) + require.Equal(t, "android desc", android.Description) + + // get and list return the description for every type + gotApple, err := ds.GetMDMAppleConfigProfile(ctx, apple.ProfileUUID) + require.NoError(t, err) + require.Equal(t, "apple desc", gotApple.Description) + gotDecl, err := ds.GetMDMAppleDeclaration(ctx, decl.DeclarationUUID) + require.NoError(t, err) + require.Equal(t, "decl desc", gotDecl.Description) + gotWin, err := ds.GetMDMWindowsConfigProfile(ctx, win.ProfileUUID) + require.NoError(t, err) + require.Equal(t, "windows desc", gotWin.Description) + gotAndroid, err := ds.GetMDMAndroidConfigProfile(ctx, android.ProfileUUID) + require.NoError(t, err) + require.Equal(t, "android desc", gotAndroid.Description) + + listed, _, err := ds.ListMDMConfigProfiles(ctx, nil, opts) + require.NoError(t, err) + require.Len(t, listed, 4) + descByName := make(map[string]string, len(listed)) + for _, p := range listed { + descByName[p.Name] = p.Description + } + require.Equal(t, map[string]string{ + "android": "android desc", + "apple": "apple desc", + "decl": "decl desc", + "windows": "windows desc", + }, descByName) + + // a description-only update must not move uploaded_at: it is not part of + // the checksum, so nothing is re-delivered + _, err = ds.UpdateMDMAppleConfigProfile(ctx, fleet.MDMAppleConfigProfile{ + ProfileUUID: apple.ProfileUUID, + Identifier: apple.Identifier, + Name: apple.Name, + Description: "apple desc 2", + }, nil) + require.NoError(t, err) + updApple, err := ds.GetMDMAppleConfigProfile(ctx, apple.ProfileUUID) + require.NoError(t, err) + require.Equal(t, "apple desc 2", updApple.Description) + require.Equal(t, gotApple.UploadedAt, updApple.UploadedAt) + require.Equal(t, gotApple.Checksum, updApple.Checksum) + + gotDecl.Description = "decl desc 2" + _, err = ds.SetOrUpdateMDMAppleDeclaration(ctx, gotDecl, nil, fleet.MDMAppleActivationKeep) + require.NoError(t, err) + updDecl, err := ds.GetMDMAppleDeclaration(ctx, decl.DeclarationUUID) + require.NoError(t, err) + require.Equal(t, "decl desc 2", updDecl.Description) + require.Equal(t, gotDecl.UploadedAt, updDecl.UploadedAt) + require.Equal(t, gotDecl.Token, updDecl.Token) + + _, err = ds.UpdateMDMWindowsConfigProfile(ctx, fleet.MDMWindowsConfigProfile{ + ProfileUUID: win.ProfileUUID, + Name: win.Name, + Description: "windows desc 2", + }, nil) + require.NoError(t, err) + updWin, err := ds.GetMDMWindowsConfigProfile(ctx, win.ProfileUUID) + require.NoError(t, err) + require.Equal(t, "windows desc 2", updWin.Description) + require.Equal(t, gotWin.UploadedAt, updWin.UploadedAt) + + _, err = ds.UpdateMDMAndroidConfigProfile(ctx, fleet.MDMAndroidConfigProfile{ + ProfileUUID: android.ProfileUUID, + Name: android.Name, + Description: "android desc 2", + }, nil) + require.NoError(t, err) + updAndroid, err := ds.GetMDMAndroidConfigProfile(ctx, android.ProfileUUID) + require.NoError(t, err) + require.Equal(t, "android desc 2", updAndroid.Description) + require.Equal(t, gotAndroid.UploadedAt, updAndroid.UploadedAt) + + // the batch path writes the description too, and a description-only + // change there is not reported as an update to the profiles' content + bApple := generateAppleCP("batch-apple", "com.example.batch-apple", 0) + bApple.Description = "batch apple" + bDecl := declForTest("batch-decl", "batch-decl", "batch-decl") + bDecl.Description = "batch decl" + bWin := windowsConfigProfileForTest(t, "batch-windows", "./Batch") + bWin.Description = "batch windows" + bAndroid := androidConfigProfileForTest(t, "batch-android", nil) + bAndroid.Description = "batch android" + _, err = ds.BatchSetMDMProfiles(ctx, nil, + []*fleet.MDMAppleConfigProfile{bApple}, []*fleet.MDMWindowsConfigProfile{bWin}, + []*fleet.MDMAppleDeclaration{bDecl}, []*fleet.MDMAndroidConfigProfile{bAndroid}, nil) + require.NoError(t, err) + + listed, _, err = ds.ListMDMConfigProfiles(ctx, nil, opts) + require.NoError(t, err) + require.Len(t, listed, 4) + descByName = make(map[string]string, len(listed)) + uploadedAtByName := make(map[string]time.Time, len(listed)) + for _, p := range listed { + descByName[p.Name] = p.Description + uploadedAtByName[p.Name] = p.UploadedAt + } + require.Equal(t, map[string]string{ + "batch-android": "batch android", + "batch-apple": "batch apple", + "batch-decl": "batch decl", + "batch-windows": "batch windows", + }, descByName) + + bApple.Description = "batch apple 2" + bDecl.Description = "batch decl 2" + bWin.Description = "batch windows 2" + bAndroid.Description = "batch android 2" + _, err = ds.BatchSetMDMProfiles(ctx, nil, + []*fleet.MDMAppleConfigProfile{bApple}, []*fleet.MDMWindowsConfigProfile{bWin}, + []*fleet.MDMAppleDeclaration{bDecl}, []*fleet.MDMAndroidConfigProfile{bAndroid}, nil) + require.NoError(t, err) + + listed, _, err = ds.ListMDMConfigProfiles(ctx, nil, opts) + require.NoError(t, err) + require.Len(t, listed, 4) + for _, p := range listed { + require.Equal(t, descByName[p.Name]+" 2", p.Description, p.Name) + require.Equal(t, uploadedAtByName[p.Name], p.UploadedAt, p.Name) + } +} + func cleanupStaleWindowsRemoveRows(t *testing.T, ds *Datastore, want map[*fleet.Host][]anyProfile) { // Collect the set of Windows host UUIDs in the assertion and the // (profile_uuid, host_uuid) pairs that are expected as remove rows. diff --git a/server/datastore/mysql/microsoft_mdm.go b/server/datastore/mysql/microsoft_mdm.go index 98e9c614579..660f5f86153 100644 --- a/server/datastore/mysql/microsoft_mdm.go +++ b/server/datastore/mysql/microsoft_mdm.go @@ -2245,6 +2245,7 @@ SELECT profile_uuid, team_id, name, + description, syncml, created_at, uploaded_at @@ -3186,8 +3187,8 @@ func (ds *Datastore) NewMDMWindowsConfigProfile(ctx context.Context, cp fleet.MD profileUUID := "w" + uuid.New().String() insertProfileStmt := ` INSERT INTO - mdm_windows_configuration_profiles (profile_uuid, team_id, name, syncml, uploaded_at) -(SELECT ?, ?, ?, ?, CURRENT_TIMESTAMP() FROM DUAL WHERE + mdm_windows_configuration_profiles (profile_uuid, team_id, name, description, syncml, uploaded_at) +(SELECT ?, ?, ?, ?, ?, CURRENT_TIMESTAMP() FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM mdm_apple_configuration_profiles WHERE name = ? AND team_id = ? ) AND NOT EXISTS ( @@ -3203,7 +3204,7 @@ INSERT INTO } err := ds.withTx(ctx, func(tx sqlx.ExtContext) error { - res, err := tx.ExecContext(ctx, insertProfileStmt, profileUUID, teamID, cp.Name, cp.SyncML, cp.Name, teamID, cp.Name, teamID, cp.Name, teamID) + res, err := tx.ExecContext(ctx, insertProfileStmt, profileUUID, teamID, cp.Name, cp.Description, cp.SyncML, cp.Name, teamID, cp.Name, teamID, cp.Name, teamID) if err != nil { switch { case IsDuplicate(err): @@ -3283,6 +3284,7 @@ INSERT INTO return &fleet.MDMWindowsConfigProfile{ ProfileUUID: profileUUID, Name: cp.Name, + Description: cp.Description, SyncML: cp.SyncML, TeamID: cp.TeamID, }, nil @@ -3327,7 +3329,7 @@ func (ds *Datastore) UpdateMDMWindowsConfigProfile(ctx context.Context, cp fleet // A rename is a fresh upload even when the bytes are identical, so // uploaded_at survives only a true no-op (as in the batch path). const setClause = `UPDATE mdm_windows_configuration_profiles -SET syncml = ?, name = ?, uploaded_at = IF(?, CURRENT_TIMESTAMP(), uploaded_at) +SET syncml = ?, name = ?, description = ?, uploaded_at = IF(?, CURRENT_TIMESTAMP(), uploaded_at) WHERE profile_uuid = ?` // A name is unique per team across all four profile tables and no index @@ -3335,7 +3337,7 @@ WHERE profile_uuid = ?` // rather than a preceding SELECT so check and write are atomic, as // NewMDMWindowsConfigProfile does on insert. stmt := setClause - args := []any{cp.SyncML, cp.Name, contentChanged || nameChanged, cp.ProfileUUID} + args := []any{cp.SyncML, cp.Name, cp.Description, contentChanged || nameChanged, cp.ProfileUUID} if nameChanged { stmt += ` AND NOT EXISTS (SELECT 1 FROM mdm_apple_configuration_profiles WHERE name = ? AND team_id = ?) @@ -3402,6 +3404,14 @@ WHERE profile_uuid = ?` }, "windows", false); err != nil { return ctxerr.Wrap(ctx, err, "updating windows profile variable associations") } + } else { + // Description is not part of the checksum, so it is written without + // touching uploaded_at. The row is known to exist from the SELECT above. + if _, err := tx.ExecContext(ctx, + `UPDATE mdm_windows_configuration_profiles SET description = ? WHERE profile_uuid = ?`, + cp.Description, cp.ProfileUUID); err != nil { + return ctxerr.Wrap(ctx, err, "updating windows mdm config profile description") + } } labels := make([]fleet.ConfigurationProfileLabel, 0, len(cp.LabelsIncludeAll)+len(cp.LabelsIncludeAny)+len(cp.LabelsExcludeAny)) @@ -3577,14 +3587,15 @@ WHERE const insertNewOrEditedProfile = ` INSERT INTO mdm_windows_configuration_profiles ( - profile_uuid, team_id, name, syncml, uploaded_at + profile_uuid, team_id, name, description, syncml, uploaded_at ) VALUES -- see https://stackoverflow.com/a/51393124/1094941 - ( CONCAT('` + fleet.MDMWindowsProfileUUIDPrefix + `', CONVERT(UUID() USING utf8mb4)), ?, ?, ?, CURRENT_TIMESTAMP() ) + ( CONCAT('` + fleet.MDMWindowsProfileUUIDPrefix + `', CONVERT(UUID() USING utf8mb4)), ?, ?, ?, ?, CURRENT_TIMESTAMP() ) ON DUPLICATE KEY UPDATE uploaded_at = IF(syncml = VALUES(syncml) AND name = VALUES(name), uploaded_at, CURRENT_TIMESTAMP()), name = VALUES(name), + description = VALUES(description), syncml = VALUES(syncml) ` @@ -3716,7 +3727,7 @@ ON DUPLICATE KEY UPDATE // insert the new profiles and the ones that have changed for _, p := range incomingProfs { - if result, err = tx.ExecContext(ctx, insertNewOrEditedProfile, profTeamID, p.Name, + if result, err = tx.ExecContext(ctx, insertNewOrEditedProfile, profTeamID, p.Name, p.Description, p.SyncML); err != nil { return false, nil, ctxerr.Wrapf(ctx, err, "insert new/edited profile with name %q", p.Name) } diff --git a/server/datastore/mysql/migrations/tables/20260924203815_AddDescriptionToMDMConfigurationProfiles.go b/server/datastore/mysql/migrations/tables/20260924203815_AddDescriptionToMDMConfigurationProfiles.go new file mode 100644 index 00000000000..dff495b5abe --- /dev/null +++ b/server/datastore/mysql/migrations/tables/20260924203815_AddDescriptionToMDMConfigurationProfiles.go @@ -0,0 +1,37 @@ +package tables + +import ( + "database/sql" + "fmt" +) + +func init() { + MigrationClient.AddMigration(Up_20260924203815, Down_20260924203815) +} + +// Free text written by the admin, shown next to the profile name. Same shape +// as teams.description. It is deliberately not part of any checksum or token +// so that editing it never re-delivers the profile. +func Up_20260924203815(tx *sql.Tx) error { + for _, table := range []string{ + "mdm_apple_configuration_profiles", + "mdm_apple_declarations", + "mdm_windows_configuration_profiles", + "mdm_android_configuration_profiles", + } { + if columnExists(tx, table, "description") { + continue + } + if _, err := tx.Exec(fmt.Sprintf(` + ALTER TABLE %s + ADD COLUMN description VARCHAR(1023) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' + `, table)); err != nil { + return fmt.Errorf("adding description to %s: %w", table, err) + } + } + return nil +} + +func Down_20260924203815(tx *sql.Tx) error { + return nil +} diff --git a/server/datastore/mysql/schema.sql b/server/datastore/mysql/schema.sql index 77c38f88694..9a51754ad64 100644 --- a/server/datastore/mysql/schema.sql +++ b/server/datastore/mysql/schema.sql @@ -2005,6 +2005,7 @@ CREATE TABLE `mdm_android_configuration_profiles` ( `uploaded_at` timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP(6), `checksum` binary(16) GENERATED ALWAYS AS (unhex(md5(cast(`raw_json` as char charset utf8mb4)))) STORED, `hidden` tinyint(1) NOT NULL DEFAULT '0', + `description` varchar(1023) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`profile_uuid`), UNIQUE KEY `auto_increment` (`auto_increment`), UNIQUE KEY `idx_mdm_android_configuration_profiles_team_id_name` (`team_id`,`name`) @@ -2040,6 +2041,7 @@ CREATE TABLE `mdm_apple_configuration_profiles` ( `scope` enum('System','User') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'System', `self_service` tinyint(1) NOT NULL DEFAULT '0', `hidden` tinyint(1) NOT NULL DEFAULT '0', + `description` varchar(1023) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`profile_uuid`), UNIQUE KEY `idx_mdm_apple_config_prof_team_identifier` (`team_id`,`identifier`), UNIQUE KEY `idx_mdm_apple_config_prof_team_name` (`team_id`,`name`), @@ -2109,6 +2111,7 @@ CREATE TABLE `mdm_apple_declarations` ( `token` binary(16) GENERATED ALWAYS AS (unhex(md5(concat(`raw_json`,ifnull(`secrets_updated_at`,_utf8mb4''))))) STORED, `scope` enum('System','User') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'System', `hidden` tinyint(1) NOT NULL DEFAULT '0', + `description` varchar(1023) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`declaration_uuid`), UNIQUE KEY `idx_mdm_apple_declaration_team_identifier` (`team_id`,`identifier`), UNIQUE KEY `idx_mdm_apple_declaration_team_name` (`team_id`,`name`), @@ -2390,6 +2393,7 @@ CREATE TABLE `mdm_windows_configuration_profiles` ( `checksum` binary(16) GENERATED ALWAYS AS (unhex(md5(`syncml`))) STORED, `secrets_updated_at` datetime(6) DEFAULT NULL, `hidden` tinyint(1) NOT NULL DEFAULT '0', + `description` varchar(1023) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`profile_uuid`), UNIQUE KEY `idx_mdm_windows_configuration_profiles_team_id_name` (`team_id`,`name`), UNIQUE KEY `auto_increment` (`auto_increment`) @@ -2492,9 +2496,9 @@ CREATE TABLE `migration_status_tables` ( `is_applied` tinyint(1) NOT NULL, `tstamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=641 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=642 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO `migration_status_tables` VALUES (1,0,1,'2020-01-01 01:01:01'),(2,20161118193812,1,'2020-01-01 01:01:01'),(3,20161118211713,1,'2020-01-01 01:01:01'),(4,20161118212436,1,'2020-01-01 01:01:01'),(5,20161118212515,1,'2020-01-01 01:01:01'),(6,20161118212528,1,'2020-01-01 01:01:01'),(7,20161118212538,1,'2020-01-01 01:01:01'),(8,20161118212549,1,'2020-01-01 01:01:01'),(9,20161118212557,1,'2020-01-01 01:01:01'),(10,20161118212604,1,'2020-01-01 01:01:01'),(11,20161118212613,1,'2020-01-01 01:01:01'),(12,20161118212621,1,'2020-01-01 01:01:01'),(13,20161118212630,1,'2020-01-01 01:01:01'),(14,20161118212641,1,'2020-01-01 01:01:01'),(15,20161118212649,1,'2020-01-01 01:01:01'),(16,20161118212656,1,'2020-01-01 01:01:01'),(17,20161118212758,1,'2020-01-01 01:01:01'),(18,20161128234849,1,'2020-01-01 01:01:01'),(19,20161230162221,1,'2020-01-01 01:01:01'),(20,20170104113816,1,'2020-01-01 01:01:01'),(21,20170105151732,1,'2020-01-01 01:01:01'),(22,20170108191242,1,'2020-01-01 01:01:01'),(23,20170109094020,1,'2020-01-01 01:01:01'),(24,20170109130438,1,'2020-01-01 01:01:01'),(25,20170110202752,1,'2020-01-01 01:01:01'),(26,20170111133013,1,'2020-01-01 01:01:01'),(27,20170117025759,1,'2020-01-01 01:01:01'),(28,20170118191001,1,'2020-01-01 01:01:01'),(29,20170119234632,1,'2020-01-01 01:01:01'),(30,20170124230432,1,'2020-01-01 01:01:01'),(31,20170127014618,1,'2020-01-01 01:01:01'),(32,20170131232841,1,'2020-01-01 01:01:01'),(33,20170223094154,1,'2020-01-01 01:01:01'),(34,20170306075207,1,'2020-01-01 01:01:01'),(35,20170309100733,1,'2020-01-01 01:01:01'),(36,20170331111922,1,'2020-01-01 01:01:01'),(37,20170502143928,1,'2020-01-01 01:01:01'),(38,20170504130602,1,'2020-01-01 01:01:01'),(39,20170509132100,1,'2020-01-01 01:01:01'),(40,20170519105647,1,'2020-01-01 01:01:01'),(41,20170519105648,1,'2020-01-01 01:01:01'),(42,20170831234300,1,'2020-01-01 01:01:01'),(43,20170831234301,1,'2020-01-01 01:01:01'),(44,20170831234303,1,'2020-01-01 01:01:01'),(45,20171116163618,1,'2020-01-01 01:01:01'),(46,20171219164727,1,'2020-01-01 01:01:01'),(47,20180620164811,1,'2020-01-01 01:01:01'),(48,20180620175054,1,'2020-01-01 01:01:01'),(49,20180620175055,1,'2020-01-01 01:01:01'),(50,20191010101639,1,'2020-01-01 01:01:01'),(51,20191010155147,1,'2020-01-01 01:01:01'),(52,20191220130734,1,'2020-01-01 01:01:01'),(53,20200311140000,1,'2020-01-01 01:01:01'),(54,20200405120000,1,'2020-01-01 01:01:01'),(55,20200407120000,1,'2020-01-01 01:01:01'),(56,20200420120000,1,'2020-01-01 01:01:01'),(57,20200504120000,1,'2020-01-01 01:01:01'),(58,20200512120000,1,'2020-01-01 01:01:01'),(59,20200707120000,1,'2020-01-01 01:01:01'),(60,20201011162341,1,'2020-01-01 01:01:01'),(61,20201021104586,1,'2020-01-01 01:01:01'),(62,20201102112520,1,'2020-01-01 01:01:01'),(63,20201208121729,1,'2020-01-01 01:01:01'),(64,20201215091637,1,'2020-01-01 01:01:01'),(65,20210119174155,1,'2020-01-01 01:01:01'),(66,20210326182902,1,'2020-01-01 01:01:01'),(67,20210421112652,1,'2020-01-01 01:01:01'),(68,20210506095025,1,'2020-01-01 01:01:01'),(69,20210513115729,1,'2020-01-01 01:01:01'),(70,20210526113559,1,'2020-01-01 01:01:01'),(71,20210601000001,1,'2020-01-01 01:01:01'),(72,20210601000002,1,'2020-01-01 01:01:01'),(73,20210601000003,1,'2020-01-01 01:01:01'),(74,20210601000004,1,'2020-01-01 01:01:01'),(75,20210601000005,1,'2020-01-01 01:01:01'),(76,20210601000006,1,'2020-01-01 01:01:01'),(77,20210601000007,1,'2020-01-01 01:01:01'),(78,20210601000008,1,'2020-01-01 01:01:01'),(79,20210606151329,1,'2020-01-01 01:01:01'),(80,20210616163757,1,'2020-01-01 01:01:01'),(81,20210617174723,1,'2020-01-01 01:01:01'),(82,20210622160235,1,'2020-01-01 01:01:01'),(83,20210623100031,1,'2020-01-01 01:01:01'),(84,20210623133615,1,'2020-01-01 01:01:01'),(85,20210708143152,1,'2020-01-01 01:01:01'),(86,20210709124443,1,'2020-01-01 01:01:01'),(87,20210712155608,1,'2020-01-01 01:01:01'),(88,20210714102108,1,'2020-01-01 01:01:01'),(89,20210719153709,1,'2020-01-01 01:01:01'),(90,20210721171531,1,'2020-01-01 01:01:01'),(91,20210723135713,1,'2020-01-01 01:01:01'),(92,20210802135933,1,'2020-01-01 01:01:01'),(93,20210806112844,1,'2020-01-01 01:01:01'),(94,20210810095603,1,'2020-01-01 01:01:01'),(95,20210811150223,1,'2020-01-01 01:01:01'),(96,20210818151827,1,'2020-01-01 01:01:01'),(97,20210818151828,1,'2020-01-01 01:01:01'),(98,20210818182258,1,'2020-01-01 01:01:01'),(99,20210819131107,1,'2020-01-01 01:01:01'),(100,20210819143446,1,'2020-01-01 01:01:01'),(101,20210903132338,1,'2020-01-01 01:01:01'),(102,20210915144307,1,'2020-01-01 01:01:01'),(103,20210920155130,1,'2020-01-01 01:01:01'),(104,20210927143115,1,'2020-01-01 01:01:01'),(105,20210927143116,1,'2020-01-01 01:01:01'),(106,20211013133706,1,'2020-01-01 01:01:01'),(107,20211013133707,1,'2020-01-01 01:01:01'),(108,20211102135149,1,'2020-01-01 01:01:01'),(109,20211109121546,1,'2020-01-01 01:01:01'),(110,20211110163320,1,'2020-01-01 01:01:01'),(111,20211116184029,1,'2020-01-01 01:01:01'),(112,20211116184030,1,'2020-01-01 01:01:01'),(113,20211202092042,1,'2020-01-01 01:01:01'),(114,20211202181033,1,'2020-01-01 01:01:01'),(115,20211207161856,1,'2020-01-01 01:01:01'),(116,20211216131203,1,'2020-01-01 01:01:01'),(117,20211221110132,1,'2020-01-01 01:01:01'),(118,20220107155700,1,'2020-01-01 01:01:01'),(119,20220125105650,1,'2020-01-01 01:01:01'),(120,20220201084510,1,'2020-01-01 01:01:01'),(121,20220208144830,1,'2020-01-01 01:01:01'),(122,20220208144831,1,'2020-01-01 01:01:01'),(123,20220215152203,1,'2020-01-01 01:01:01'),(124,20220223113157,1,'2020-01-01 01:01:01'),(125,20220307104655,1,'2020-01-01 01:01:01'),(126,20220309133956,1,'2020-01-01 01:01:01'),(127,20220316155700,1,'2020-01-01 01:01:01'),(128,20220323152301,1,'2020-01-01 01:01:01'),(129,20220330100659,1,'2020-01-01 01:01:01'),(130,20220404091216,1,'2020-01-01 01:01:01'),(131,20220419140750,1,'2020-01-01 01:01:01'),(132,20220428140039,1,'2020-01-01 01:01:01'),(133,20220503134048,1,'2020-01-01 01:01:01'),(134,20220524102918,1,'2020-01-01 01:01:01'),(135,20220526123327,1,'2020-01-01 01:01:01'),(136,20220526123328,1,'2020-01-01 01:01:01'),(137,20220526123329,1,'2020-01-01 01:01:01'),(138,20220608113128,1,'2020-01-01 01:01:01'),(139,20220627104817,1,'2020-01-01 01:01:01'),(140,20220704101843,1,'2020-01-01 01:01:01'),(141,20220708095046,1,'2020-01-01 01:01:01'),(142,20220713091130,1,'2020-01-01 01:01:01'),(143,20220802135510,1,'2020-01-01 01:01:01'),(144,20220818101352,1,'2020-01-01 01:01:01'),(145,20220822161445,1,'2020-01-01 01:01:01'),(146,20220831100036,1,'2020-01-01 01:01:01'),(147,20220831100151,1,'2020-01-01 01:01:01'),(148,20220908181826,1,'2020-01-01 01:01:01'),(149,20220914154915,1,'2020-01-01 01:01:01'),(150,20220915165115,1,'2020-01-01 01:01:01'),(151,20220915165116,1,'2020-01-01 01:01:01'),(152,20220928100158,1,'2020-01-01 01:01:01'),(153,20221014084130,1,'2020-01-01 01:01:01'),(154,20221027085019,1,'2020-01-01 01:01:01'),(155,20221101103952,1,'2020-01-01 01:01:01'),(156,20221104144401,1,'2020-01-01 01:01:01'),(157,20221109100749,1,'2020-01-01 01:01:01'),(158,20221115104546,1,'2020-01-01 01:01:01'),(159,20221130114928,1,'2020-01-01 01:01:01'),(160,20221205112142,1,'2020-01-01 01:01:01'),(161,20221216115820,1,'2020-01-01 01:01:01'),(162,20221220195934,1,'2020-01-01 01:01:01'),(163,20221220195935,1,'2020-01-01 01:01:01'),(164,20221223174807,1,'2020-01-01 01:01:01'),(165,20221227163855,1,'2020-01-01 01:01:01'),(166,20221227163856,1,'2020-01-01 01:01:01'),(167,20230202224725,1,'2020-01-01 01:01:01'),(168,20230206163608,1,'2020-01-01 01:01:01'),(169,20230214131519,1,'2020-01-01 01:01:01'),(170,20230303135738,1,'2020-01-01 01:01:01'),(171,20230313135301,1,'2020-01-01 01:01:01'),(172,20230313141819,1,'2020-01-01 01:01:01'),(173,20230315104937,1,'2020-01-01 01:01:01'),(174,20230317173844,1,'2020-01-01 01:01:01'),(175,20230320133602,1,'2020-01-01 01:01:01'),(176,20230330100011,1,'2020-01-01 01:01:01'),(177,20230330134823,1,'2020-01-01 01:01:01'),(178,20230405232025,1,'2020-01-01 01:01:01'),(179,20230408084104,1,'2020-01-01 01:01:01'),(180,20230411102858,1,'2020-01-01 01:01:01'),(181,20230421155932,1,'2020-01-01 01:01:01'),(182,20230425082126,1,'2020-01-01 01:01:01'),(183,20230425105727,1,'2020-01-01 01:01:01'),(184,20230501154913,1,'2020-01-01 01:01:01'),(185,20230503101418,1,'2020-01-01 01:01:01'),(186,20230515144206,1,'2020-01-01 01:01:01'),(187,20230517140952,1,'2020-01-01 01:01:01'),(188,20230517152807,1,'2020-01-01 01:01:01'),(189,20230518114155,1,'2020-01-01 01:01:01'),(190,20230520153236,1,'2020-01-01 01:01:01'),(191,20230525151159,1,'2020-01-01 01:01:01'),(192,20230530122103,1,'2020-01-01 01:01:01'),(193,20230602111827,1,'2020-01-01 01:01:01'),(194,20230608103123,1,'2020-01-01 01:01:01'),(195,20230629140529,1,'2020-01-01 01:01:01'),(196,20230629140530,1,'2020-01-01 01:01:01'),(197,20230711144622,1,'2020-01-01 01:01:01'),(198,20230721135421,1,'2020-01-01 01:01:01'),(199,20230721161508,1,'2020-01-01 01:01:01'),(200,20230726115701,1,'2020-01-01 01:01:01'),(201,20230807100822,1,'2020-01-01 01:01:01'),(202,20230814150442,1,'2020-01-01 01:01:01'),(203,20230823122728,1,'2020-01-01 01:01:01'),(204,20230906152143,1,'2020-01-01 01:01:01'),(205,20230911163618,1,'2020-01-01 01:01:01'),(206,20230912101759,1,'2020-01-01 01:01:01'),(207,20230915101341,1,'2020-01-01 01:01:01'),(208,20230918132351,1,'2020-01-01 01:01:01'),(209,20231004144339,1,'2020-01-01 01:01:01'),(210,20231009094541,1,'2020-01-01 01:01:01'),(211,20231009094542,1,'2020-01-01 01:01:01'),(212,20231009094543,1,'2020-01-01 01:01:01'),(213,20231009094544,1,'2020-01-01 01:01:01'),(214,20231016091915,1,'2020-01-01 01:01:01'),(215,20231024174135,1,'2020-01-01 01:01:01'),(216,20231025120016,1,'2020-01-01 01:01:01'),(217,20231025160156,1,'2020-01-01 01:01:01'),(218,20231031165350,1,'2020-01-01 01:01:01'),(219,20231106144110,1,'2020-01-01 01:01:01'),(220,20231107130934,1,'2020-01-01 01:01:01'),(221,20231109115838,1,'2020-01-01 01:01:01'),(222,20231121054530,1,'2020-01-01 01:01:01'),(223,20231122101320,1,'2020-01-01 01:01:01'),(224,20231130132828,1,'2020-01-01 01:01:01'),(225,20231130132931,1,'2020-01-01 01:01:01'),(226,20231204155427,1,'2020-01-01 01:01:01'),(227,20231206142340,1,'2020-01-01 01:01:01'),(228,20231207102320,1,'2020-01-01 01:01:01'),(229,20231207102321,1,'2020-01-01 01:01:01'),(230,20231207133731,1,'2020-01-01 01:01:01'),(231,20231212094238,1,'2020-01-01 01:01:01'),(232,20231212095734,1,'2020-01-01 01:01:01'),(233,20231212161121,1,'2020-01-01 01:01:01'),(234,20231215122713,1,'2020-01-01 01:01:01'),(235,20231219143041,1,'2020-01-01 01:01:01'),(236,20231224070653,1,'2020-01-01 01:01:01'),(237,20240110134315,1,'2020-01-01 01:01:01'),(238,20240119091637,1,'2020-01-01 01:01:01'),(239,20240126020642,1,'2020-01-01 01:01:01'),(240,20240126020643,1,'2020-01-01 01:01:01'),(241,20240129162819,1,'2020-01-01 01:01:01'),(242,20240130115133,1,'2020-01-01 01:01:01'),(243,20240131083822,1,'2020-01-01 01:01:01'),(244,20240205095928,1,'2020-01-01 01:01:01'),(245,20240205121956,1,'2020-01-01 01:01:01'),(246,20240209110212,1,'2020-01-01 01:01:01'),(247,20240212111533,1,'2020-01-01 01:01:01'),(248,20240221112844,1,'2020-01-01 01:01:01'),(249,20240222073518,1,'2020-01-01 01:01:01'),(250,20240222135115,1,'2020-01-01 01:01:01'),(251,20240226082255,1,'2020-01-01 01:01:01'),(252,20240228082706,1,'2020-01-01 01:01:01'),(253,20240301173035,1,'2020-01-01 01:01:01'),(254,20240302111134,1,'2020-01-01 01:01:01'),(255,20240312103753,1,'2020-01-01 01:01:01'),(256,20240313143416,1,'2020-01-01 01:01:01'),(257,20240314085226,1,'2020-01-01 01:01:01'),(258,20240314151747,1,'2020-01-01 01:01:01'),(259,20240320145650,1,'2020-01-01 01:01:01'),(260,20240327115530,1,'2020-01-01 01:01:01'),(261,20240327115617,1,'2020-01-01 01:01:01'),(262,20240408085837,1,'2020-01-01 01:01:01'),(263,20240415104633,1,'2020-01-01 01:01:01'),(264,20240430111727,1,'2020-01-01 01:01:01'),(265,20240515200020,1,'2020-01-01 01:01:01'),(266,20240521143023,1,'2020-01-01 01:01:01'),(267,20240521143024,1,'2020-01-01 01:01:01'),(268,20240601174138,1,'2020-01-01 01:01:01'),(269,20240607133721,1,'2020-01-01 01:01:01'),(270,20240612150059,1,'2020-01-01 01:01:01'),(271,20240613162201,1,'2020-01-01 01:01:01'),(272,20240613172616,1,'2020-01-01 01:01:01'),(273,20240618142419,1,'2020-01-01 01:01:01'),(274,20240625093543,1,'2020-01-01 01:01:01'),(275,20240626195531,1,'2020-01-01 01:01:01'),(276,20240702123921,1,'2020-01-01 01:01:01'),(277,20240703154849,1,'2020-01-01 01:01:01'),(278,20240707134035,1,'2020-01-01 01:01:01'),(279,20240707134036,1,'2020-01-01 01:01:01'),(280,20240709124958,1,'2020-01-01 01:01:01'),(281,20240709132642,1,'2020-01-01 01:01:01'),(282,20240709183940,1,'2020-01-01 01:01:01'),(283,20240710155623,1,'2020-01-01 01:01:01'),(284,20240723102712,1,'2020-01-01 01:01:01'),(285,20240725152735,1,'2020-01-01 01:01:01'),(286,20240725182118,1,'2020-01-01 01:01:01'),(287,20240726100517,1,'2020-01-01 01:01:01'),(288,20240730171504,1,'2020-01-01 01:01:01'),(289,20240730174056,1,'2020-01-01 01:01:01'),(290,20240730215453,1,'2020-01-01 01:01:01'),(291,20240730374423,1,'2020-01-01 01:01:01'),(292,20240801115359,1,'2020-01-01 01:01:01'),(293,20240802101043,1,'2020-01-01 01:01:01'),(294,20240802113716,1,'2020-01-01 01:01:01'),(295,20240814135330,1,'2020-01-01 01:01:01'),(296,20240815000000,1,'2020-01-01 01:01:01'),(297,20240815000001,1,'2020-01-01 01:01:01'),(298,20240816103247,1,'2020-01-01 01:01:01'),(299,20240820091218,1,'2020-01-01 01:01:01'),(300,20240826111228,1,'2020-01-01 01:01:01'),(301,20240826160025,1,'2020-01-01 01:01:01'),(302,20240829165448,1,'2020-01-01 01:01:01'),(303,20240829165605,1,'2020-01-01 01:01:01'),(304,20240829165715,1,'2020-01-01 01:01:01'),(305,20240829165930,1,'2020-01-01 01:01:01'),(306,20240829170023,1,'2020-01-01 01:01:01'),(307,20240829170033,1,'2020-01-01 01:01:01'),(308,20240829170044,1,'2020-01-01 01:01:01'),(309,20240905105135,1,'2020-01-01 01:01:01'),(310,20240905140514,1,'2020-01-01 01:01:01'),(311,20240905200000,1,'2020-01-01 01:01:01'),(312,20240905200001,1,'2020-01-01 01:01:01'),(313,20241002104104,1,'2020-01-01 01:01:01'),(314,20241002104105,1,'2020-01-01 01:01:01'),(315,20241002104106,1,'2020-01-01 01:01:01'),(316,20241002210000,1,'2020-01-01 01:01:01'),(317,20241003145349,1,'2020-01-01 01:01:01'),(318,20241004005000,1,'2020-01-01 01:01:01'),(319,20241008083925,1,'2020-01-01 01:01:01'),(320,20241009090010,1,'2020-01-01 01:01:01'),(321,20241017163402,1,'2020-01-01 01:01:01'),(322,20241021224359,1,'2020-01-01 01:01:01'),(323,20241022140321,1,'2020-01-01 01:01:01'),(324,20241025111236,1,'2020-01-01 01:01:01'),(325,20241025112748,1,'2020-01-01 01:01:01'),(326,20241025141855,1,'2020-01-01 01:01:01'),(327,20241110152839,1,'2020-01-01 01:01:01'),(328,20241110152840,1,'2020-01-01 01:01:01'),(329,20241110152841,1,'2020-01-01 01:01:01'),(330,20241116233322,1,'2020-01-01 01:01:01'),(331,20241122171434,1,'2020-01-01 01:01:01'),(332,20241125150614,1,'2020-01-01 01:01:01'),(333,20241203125346,1,'2020-01-01 01:01:01'),(334,20241203130032,1,'2020-01-01 01:01:01'),(335,20241205122800,1,'2020-01-01 01:01:01'),(336,20241209164540,1,'2020-01-01 01:01:01'),(337,20241210140021,1,'2020-01-01 01:01:01'),(338,20241219180042,1,'2020-01-01 01:01:01'),(339,20241220100000,1,'2020-01-01 01:01:01'),(340,20241220114903,1,'2020-01-01 01:01:01'),(341,20241220114904,1,'2020-01-01 01:01:01'),(342,20241224000000,1,'2020-01-01 01:01:01'),(343,20241230000000,1,'2020-01-01 01:01:01'),(344,20241231112624,1,'2020-01-01 01:01:01'),(345,20250102121439,1,'2020-01-01 01:01:01'),(346,20250121094045,1,'2020-01-01 01:01:01'),(347,20250121094500,1,'2020-01-01 01:01:01'),(348,20250121094600,1,'2020-01-01 01:01:01'),(349,20250121094700,1,'2020-01-01 01:01:01'),(350,20250124194347,1,'2020-01-01 01:01:01'),(351,20250127162751,1,'2020-01-01 01:01:01'),(352,20250213104005,1,'2020-01-01 01:01:01'),(353,20250214205657,1,'2020-01-01 01:01:01'),(354,20250217093329,1,'2020-01-01 01:01:01'),(355,20250219090511,1,'2020-01-01 01:01:01'),(356,20250219100000,1,'2020-01-01 01:01:01'),(357,20250219142401,1,'2020-01-01 01:01:01'),(358,20250224184002,1,'2020-01-01 01:01:01'),(359,20250225085436,1,'2020-01-01 01:01:01'),(360,20250226000000,1,'2020-01-01 01:01:01'),(361,20250226153445,1,'2020-01-01 01:01:01'),(362,20250304162702,1,'2020-01-01 01:01:01'),(363,20250306144233,1,'2020-01-01 01:01:01'),(364,20250313163430,1,'2020-01-01 01:01:01'),(365,20250317130944,1,'2020-01-01 01:01:01'),(366,20250318165922,1,'2020-01-01 01:01:01'),(367,20250320132525,1,'2020-01-01 01:01:01'),(368,20250320200000,1,'2020-01-01 01:01:01'),(369,20250326161930,1,'2020-01-01 01:01:01'),(370,20250326161931,1,'2020-01-01 01:01:01'),(371,20250331042354,1,'2020-01-01 01:01:01'),(372,20250331154206,1,'2020-01-01 01:01:01'),(373,20250401155831,1,'2020-01-01 01:01:01'),(374,20250408133233,1,'2020-01-01 01:01:01'),(375,20250410104321,1,'2020-01-01 01:01:01'),(376,20250421085116,1,'2020-01-01 01:01:01'),(377,20250422095806,1,'2020-01-01 01:01:01'),(378,20250424153059,1,'2020-01-01 01:01:01'),(379,20250430103833,1,'2020-01-01 01:01:01'),(380,20250430112622,1,'2020-01-01 01:01:01'),(381,20250501162727,1,'2020-01-01 01:01:01'),(382,20250502154517,1,'2020-01-01 01:01:01'),(383,20250502222222,1,'2020-01-01 01:01:01'),(384,20250507170845,1,'2020-01-01 01:01:01'),(385,20250513162912,1,'2020-01-01 01:01:01'),(386,20250519161614,1,'2020-01-01 01:01:01'),(387,20250519170000,1,'2020-01-01 01:01:01'),(388,20250520153848,1,'2020-01-01 01:01:01'),(389,20250528115932,1,'2020-01-01 01:01:01'),(390,20250529102706,1,'2020-01-01 01:01:01'),(391,20250603105558,1,'2020-01-01 01:01:01'),(392,20250609102714,1,'2020-01-01 01:01:01'),(393,20250609112613,1,'2020-01-01 01:01:01'),(394,20250613103810,1,'2020-01-01 01:01:01'),(395,20250616193950,1,'2020-01-01 01:01:01'),(396,20250624140757,1,'2020-01-01 01:01:01'),(397,20250626130239,1,'2020-01-01 01:01:01'),(398,20250629131032,1,'2020-01-01 01:01:01'),(399,20250701155654,1,'2020-01-01 01:01:01'),(400,20250707095725,1,'2020-01-01 01:01:01'),(401,20250716152435,1,'2020-01-01 01:01:01'),(402,20250718091828,1,'2020-01-01 01:01:01'),(403,20250728122229,1,'2020-01-01 01:01:01'),(404,20250731122715,1,'2020-01-01 01:01:01'),(405,20250731151000,1,'2020-01-01 01:01:01'),(406,20250803000000,1,'2020-01-01 01:01:01'),(407,20250805083116,1,'2020-01-01 01:01:01'),(408,20250807140441,1,'2020-01-01 01:01:01'),(409,20250808000000,1,'2020-01-01 01:01:01'),(410,20250811155036,1,'2020-01-01 01:01:01'),(411,20250813205039,1,'2020-01-01 01:01:01'),(412,20250814123333,1,'2020-01-01 01:01:01'),(413,20250815130115,1,'2020-01-01 01:01:01'),(414,20250816115553,1,'2020-01-01 01:01:01'),(415,20250817154557,1,'2020-01-01 01:01:01'),(416,20250825113751,1,'2020-01-01 01:01:01'),(417,20250827113140,1,'2020-01-01 01:01:01'),(418,20250828120836,1,'2020-01-01 01:01:01'),(419,20250902112642,1,'2020-01-01 01:01:01'),(420,20250904091745,1,'2020-01-01 01:01:01'),(421,20250905090000,1,'2020-01-01 01:01:01'),(422,20250922083056,1,'2020-01-01 01:01:01'),(423,20250923120000,1,'2020-01-01 01:01:01'),(424,20250926123048,1,'2020-01-01 01:01:01'),(425,20251015103505,1,'2020-01-01 01:01:01'),(426,20251015103600,1,'2020-01-01 01:01:01'),(427,20251015103700,1,'2020-01-01 01:01:01'),(428,20251015103800,1,'2020-01-01 01:01:01'),(429,20251015103900,1,'2020-01-01 01:01:01'),(430,20251028140000,1,'2020-01-01 01:01:01'),(431,20251028140100,1,'2020-01-01 01:01:01'),(432,20251028140110,1,'2020-01-01 01:01:01'),(433,20251028140200,1,'2020-01-01 01:01:01'),(434,20251028140300,1,'2020-01-01 01:01:01'),(435,20251028140400,1,'2020-01-01 01:01:01'),(436,20251031154558,1,'2020-01-01 01:01:01'),(437,20251103160848,1,'2020-01-01 01:01:01'),(438,20251104112849,1,'2020-01-01 01:01:01'),(439,20251106000000,1,'2020-01-01 01:01:01'),(440,20251107164629,1,'2020-01-01 01:01:01'),(441,20251107170854,1,'2020-01-01 01:01:01'),(442,20251110172137,1,'2020-01-01 01:01:01'),(443,20251111153133,1,'2020-01-01 01:01:01'),(444,20251117020000,1,'2020-01-01 01:01:01'),(445,20251117020100,1,'2020-01-01 01:01:01'),(446,20251117020200,1,'2020-01-01 01:01:01'),(447,20251121100000,1,'2020-01-01 01:01:01'),(448,20251121124239,1,'2020-01-01 01:01:01'),(449,20251124090450,1,'2020-01-01 01:01:01'),(450,20251124135808,1,'2020-01-01 01:01:01'),(451,20251124140138,1,'2020-01-01 01:01:01'),(452,20251124162948,1,'2020-01-01 01:01:01'),(453,20251127113559,1,'2020-01-01 01:01:01'),(454,20251202162232,1,'2020-01-01 01:01:01'),(455,20251203170808,1,'2020-01-01 01:01:01'),(456,20251207050413,1,'2020-01-01 01:01:01'),(457,20251208215800,1,'2020-01-01 01:01:01'),(458,20251209221730,1,'2020-01-01 01:01:01'),(459,20251209221850,1,'2020-01-01 01:01:01'),(460,20251215163721,1,'2020-01-01 01:01:01'),(461,20251217000000,1,'2020-01-01 01:01:01'),(462,20251217120000,1,'2020-01-01 01:01:01'),(463,20251229000000,1,'2020-01-01 01:01:01'),(464,20251229000010,1,'2020-01-01 01:01:01'),(465,20251229000020,1,'2020-01-01 01:01:01'),(466,20260106000000,1,'2020-01-01 01:01:01'),(467,20260108200708,1,'2020-01-01 01:01:01'),(468,20260108214732,1,'2020-01-01 01:01:01'),(469,20260109231821,1,'2020-01-01 01:01:01'),(470,20260113012054,1,'2020-01-01 01:01:01'),(471,20260124200020,1,'2020-01-01 01:01:01'),(472,20260126150840,1,'2020-01-01 01:01:01'),(473,20260126210724,1,'2020-01-01 01:01:01'),(474,20260202151756,1,'2020-01-01 01:01:01'),(475,20260205184907,1,'2020-01-01 01:01:01'),(476,20260210151544,1,'2020-01-01 01:01:01'),(477,20260210155109,1,'2020-01-01 01:01:01'),(478,20260210181120,1,'2020-01-01 01:01:01'),(479,20260211200153,1,'2020-01-01 01:01:01'),(480,20260217141240,1,'2020-01-01 01:01:01'),(481,20260217200906,1,'2020-01-01 01:01:01'),(482,20260218175704,1,'2020-01-01 01:01:01'),(483,20260314120000,1,'2020-01-01 01:01:01'),(484,20260316120000,1,'2020-01-01 01:01:01'),(485,20260316120001,1,'2020-01-01 01:01:01'),(486,20260316120002,1,'2020-01-01 01:01:01'),(487,20260316120003,1,'2020-01-01 01:01:01'),(488,20260316120004,1,'2020-01-01 01:01:01'),(489,20260316120005,1,'2020-01-01 01:01:01'),(490,20260316120006,1,'2020-01-01 01:01:01'),(491,20260316120007,1,'2020-01-01 01:01:01'),(492,20260316120008,1,'2020-01-01 01:01:01'),(493,20260316120009,1,'2020-01-01 01:01:01'),(494,20260316120010,1,'2020-01-01 01:01:01'),(495,20260317120000,1,'2020-01-01 01:01:01'),(496,20260318184559,1,'2020-01-01 01:01:01'),(497,20260319120000,1,'2020-01-01 01:01:01'),(498,20260323144117,1,'2020-01-01 01:01:01'),(499,20260324161944,1,'2020-01-01 01:01:01'),(500,20260324223334,1,'2020-01-01 01:01:01'),(501,20260326131501,1,'2020-01-01 01:01:01'),(502,20260326210603,1,'2020-01-01 01:01:01'),(503,20260331000000,1,'2020-01-01 01:01:01'),(504,20260401153000,1,'2020-01-01 01:01:01'),(505,20260401153001,1,'2020-01-01 01:01:01'),(506,20260401153503,1,'2020-01-01 01:01:01'),(507,20260403120000,1,'2020-01-01 01:01:01'),(508,20260409153713,1,'2020-01-01 01:01:01'),(509,20260409153714,1,'2020-01-01 01:01:01'),(510,20260409153715,1,'2020-01-01 01:01:01'),(511,20260409153716,1,'2020-01-01 01:01:01'),(512,20260409153717,1,'2020-01-01 01:01:01'),(513,20260409183610,1,'2020-01-01 01:01:01'),(514,20260410173222,1,'2020-01-01 01:01:01'),(515,20260422181702,1,'2020-01-01 01:01:01'),(516,20260423161823,1,'2020-01-01 01:01:01'),(517,20260423161824,1,'2020-01-01 01:01:01'),(518,20260518194422,1,'2020-01-01 01:01:01'),(519,20260522195224,1,'2020-01-01 01:01:01'),(520,20260522195225,1,'2020-01-01 01:01:01'),(521,20260522195226,1,'2020-01-01 01:01:01'),(522,20260522195227,1,'2020-01-01 01:01:01'),(523,20260522195229,1,'2020-01-01 01:01:01'),(524,20260522195230,1,'2020-01-01 01:01:01'),(525,20260522195231,1,'2020-01-01 01:01:01'),(526,20260522195232,1,'2020-01-01 01:01:01'),(527,20260522195233,1,'2020-01-01 01:01:01'),(528,20260522195234,1,'2020-01-01 01:01:01'),(529,20260522195235,1,'2020-01-01 01:01:01'),(530,20260527215817,1,'2020-01-01 01:01:01'),(531,20260527215818,1,'2020-01-01 01:01:01'),(532,20260528201143,1,'2020-01-01 01:01:01'),(533,20260528201150,1,'2020-01-01 01:01:01'),(534,20260528211626,1,'2020-01-01 01:01:01'),(535,20260528213326,1,'2020-01-01 01:01:01'),(536,20260529091823,1,'2020-01-01 01:01:01'),(537,20260529120000,1,'2020-01-01 01:01:01'),(538,20260601200727,1,'2020-01-01 01:01:01'),(539,20260603101320,1,'2020-01-01 01:01:01'),(540,20260603120000,1,'2020-01-01 01:01:01'),(541,20260604221206,1,'2020-01-01 01:01:01'),(542,20260605195941,1,'2020-01-01 01:01:01'),(543,20260606051849,1,'2020-01-01 01:01:01'),(544,20260608160653,1,'2020-01-01 01:01:01'),(545,20260608202705,1,'2020-01-01 01:01:01'),(546,20260608210432,1,'2020-01-01 01:01:01'),(547,20260610172952,1,'2020-01-01 01:01:01'),(548,20260624210253,1,'2020-01-01 01:01:01'),(549,20260624210311,1,'2020-01-01 01:01:01'),(550,20260626120000,1,'2020-01-01 01:01:01'),(551,20260702013055,1,'2020-01-01 01:01:01'),(552,20260702013056,1,'2020-01-01 01:01:01'),(553,20260702013057,1,'2020-01-01 01:01:01'),(554,20260702013058,1,'2020-01-01 01:01:01'),(555,20260702013059,1,'2020-01-01 01:01:01'),(556,20260702013100,1,'2020-01-01 01:01:01'),(557,20260702013101,1,'2020-01-01 01:01:01'),(558,20260702013102,1,'2020-01-01 01:01:01'),(559,20260702164518,1,'2020-01-01 01:01:01'),(560,20260717152653,1,'2020-01-01 01:01:01'),(561,20260723181401,1,'2020-01-01 01:01:01'),(562,20260723181402,1,'2020-01-01 01:01:01'),(563,20260723181403,1,'2020-01-01 01:01:01'),(564,20260723181404,1,'2020-01-01 01:01:01'),(565,20260723181405,1,'2020-01-01 01:01:01'),(566,20260723181406,1,'2020-01-01 01:01:01'),(567,20260723181407,1,'2020-01-01 01:01:01'),(568,20260723181408,1,'2020-01-01 01:01:01'),(569,20260723181409,1,'2020-01-01 01:01:01'),(570,20260723181410,1,'2020-01-01 01:01:01'),(571,20260723181411,1,'2020-01-01 01:01:01'),(572,20260723181412,1,'2020-01-01 01:01:01'),(573,20260723181413,1,'2020-01-01 01:01:01'),(574,20260724010000,1,'2020-01-01 01:01:01'),(575,20260724134801,1,'2020-01-01 01:01:01'),(576,20260727083533,1,'2020-01-01 01:01:01'),(577,20260727084359,1,'2020-01-01 01:01:01'),(578,20260729110229,1,'2020-01-01 01:01:01'),(579,20260729115013,1,'2020-01-01 01:01:01'),(580,20260731213352,1,'2020-01-01 01:01:01'),(581,20260803135530,1,'2020-01-01 01:01:01'),(582,20260803182251,1,'2020-01-01 01:01:01'),(583,20260805161502,1,'2020-01-01 01:01:01'),(584,20260806154139,1,'2020-01-01 01:01:01'),(585,20260806154150,1,'2020-01-01 01:01:01'),(586,20260806210232,1,'2020-01-01 01:01:01'),(587,20260807120050,1,'2020-01-01 01:01:01'),(588,20260807140831,1,'2020-01-01 01:01:01'),(589,20260807151355,1,'2020-01-01 01:01:01'),(590,20260810152924,1,'2020-01-01 01:01:01'),(591,20260810160000,1,'2020-01-01 01:01:01'),(592,20260810192005,1,'2020-01-01 01:01:01'),(593,20260812083512,1,'2020-01-01 01:01:01'),(594,20260812134345,1,'2020-01-01 01:01:01'),(595,20260814183816,1,'2020-01-01 01:01:01'),(596,20260817080402,1,'2020-01-01 01:01:01'),(597,20260817110708,1,'2020-01-01 01:01:01'),(598,20260818171921,1,'2020-01-01 01:01:01'),(599,20260818182457,1,'2020-01-01 01:01:01'),(600,20260821182648,1,'2020-01-01 01:01:01'),(601,20260821201620,1,'2020-01-01 01:01:01'),(602,20260822030354,1,'2020-01-01 01:01:01'),(603,20260825213833,1,'2020-01-01 01:01:01'),(604,20260827170502,1,'2020-01-01 01:01:01'),(605,20260828172118,1,'2020-01-01 01:01:01'),(606,20260831190535,1,'2020-01-01 01:01:01'),(607,20260901192408,1,'2020-01-01 01:01:01'),(608,20260901200001,1,'2020-01-01 01:01:01'),(609,20260901200002,1,'2020-01-01 01:01:01'),(610,20260902083032,1,'2020-01-01 01:01:01'),(611,20260902091843,1,'2020-01-01 01:01:01'),(612,20260902124249,1,'2020-01-01 01:01:01'),(613,20260902140128,1,'2020-01-01 01:01:01'),(614,20260902140158,1,'2020-01-01 01:01:01'),(615,20260902140230,1,'2020-01-01 01:01:01'),(616,20260902150237,1,'2020-01-01 01:01:01'),(617,20260904202219,1,'2020-01-01 01:01:01'),(618,20260908152437,1,'2020-01-01 01:01:01'),(619,20260908164600,1,'2020-01-01 01:01:01'),(620,20260909074539,1,'2020-01-01 01:01:01'),(621,20260909142539,1,'2020-01-01 01:01:01'),(622,20260910153522,1,'2020-01-01 01:01:01'),(623,20260910194211,1,'2020-01-01 01:01:01'),(624,20260916091319,1,'2020-01-01 01:01:01'),(625,20260916143823,1,'2020-01-01 01:01:01'),(626,20260916145443,1,'2020-01-01 01:01:01'),(627,20260916150929,1,'2020-01-01 01:01:01'),(628,20260921141651,1,'2020-01-01 01:01:01'),(629,20260921165359,1,'2020-01-01 01:01:01'),(630,20260921170000,1,'2020-01-01 01:01:01'),(631,20260921170001,1,'2020-01-01 01:01:01'),(632,20260921170002,1,'2020-01-01 01:01:01'),(633,20260922041729,1,'2020-01-01 01:01:01'),(634,20260922041731,1,'2020-01-01 01:01:01'),(635,20260922041732,1,'2020-01-01 01:01:01'),(636,20260922041733,1,'2020-01-01 01:01:01'),(637,20260922164155,1,'2020-01-01 01:01:01'),(638,20260923061611,1,'2020-01-01 01:01:01'),(639,20260923180303,1,'2020-01-01 01:01:01'),(640,20260923183241,1,'2020-01-01 01:01:01'); +INSERT INTO `migration_status_tables` VALUES (1,0,1,'2020-01-01 01:01:01'),(2,20161118193812,1,'2020-01-01 01:01:01'),(3,20161118211713,1,'2020-01-01 01:01:01'),(4,20161118212436,1,'2020-01-01 01:01:01'),(5,20161118212515,1,'2020-01-01 01:01:01'),(6,20161118212528,1,'2020-01-01 01:01:01'),(7,20161118212538,1,'2020-01-01 01:01:01'),(8,20161118212549,1,'2020-01-01 01:01:01'),(9,20161118212557,1,'2020-01-01 01:01:01'),(10,20161118212604,1,'2020-01-01 01:01:01'),(11,20161118212613,1,'2020-01-01 01:01:01'),(12,20161118212621,1,'2020-01-01 01:01:01'),(13,20161118212630,1,'2020-01-01 01:01:01'),(14,20161118212641,1,'2020-01-01 01:01:01'),(15,20161118212649,1,'2020-01-01 01:01:01'),(16,20161118212656,1,'2020-01-01 01:01:01'),(17,20161118212758,1,'2020-01-01 01:01:01'),(18,20161128234849,1,'2020-01-01 01:01:01'),(19,20161230162221,1,'2020-01-01 01:01:01'),(20,20170104113816,1,'2020-01-01 01:01:01'),(21,20170105151732,1,'2020-01-01 01:01:01'),(22,20170108191242,1,'2020-01-01 01:01:01'),(23,20170109094020,1,'2020-01-01 01:01:01'),(24,20170109130438,1,'2020-01-01 01:01:01'),(25,20170110202752,1,'2020-01-01 01:01:01'),(26,20170111133013,1,'2020-01-01 01:01:01'),(27,20170117025759,1,'2020-01-01 01:01:01'),(28,20170118191001,1,'2020-01-01 01:01:01'),(29,20170119234632,1,'2020-01-01 01:01:01'),(30,20170124230432,1,'2020-01-01 01:01:01'),(31,20170127014618,1,'2020-01-01 01:01:01'),(32,20170131232841,1,'2020-01-01 01:01:01'),(33,20170223094154,1,'2020-01-01 01:01:01'),(34,20170306075207,1,'2020-01-01 01:01:01'),(35,20170309100733,1,'2020-01-01 01:01:01'),(36,20170331111922,1,'2020-01-01 01:01:01'),(37,20170502143928,1,'2020-01-01 01:01:01'),(38,20170504130602,1,'2020-01-01 01:01:01'),(39,20170509132100,1,'2020-01-01 01:01:01'),(40,20170519105647,1,'2020-01-01 01:01:01'),(41,20170519105648,1,'2020-01-01 01:01:01'),(42,20170831234300,1,'2020-01-01 01:01:01'),(43,20170831234301,1,'2020-01-01 01:01:01'),(44,20170831234303,1,'2020-01-01 01:01:01'),(45,20171116163618,1,'2020-01-01 01:01:01'),(46,20171219164727,1,'2020-01-01 01:01:01'),(47,20180620164811,1,'2020-01-01 01:01:01'),(48,20180620175054,1,'2020-01-01 01:01:01'),(49,20180620175055,1,'2020-01-01 01:01:01'),(50,20191010101639,1,'2020-01-01 01:01:01'),(51,20191010155147,1,'2020-01-01 01:01:01'),(52,20191220130734,1,'2020-01-01 01:01:01'),(53,20200311140000,1,'2020-01-01 01:01:01'),(54,20200405120000,1,'2020-01-01 01:01:01'),(55,20200407120000,1,'2020-01-01 01:01:01'),(56,20200420120000,1,'2020-01-01 01:01:01'),(57,20200504120000,1,'2020-01-01 01:01:01'),(58,20200512120000,1,'2020-01-01 01:01:01'),(59,20200707120000,1,'2020-01-01 01:01:01'),(60,20201011162341,1,'2020-01-01 01:01:01'),(61,20201021104586,1,'2020-01-01 01:01:01'),(62,20201102112520,1,'2020-01-01 01:01:01'),(63,20201208121729,1,'2020-01-01 01:01:01'),(64,20201215091637,1,'2020-01-01 01:01:01'),(65,20210119174155,1,'2020-01-01 01:01:01'),(66,20210326182902,1,'2020-01-01 01:01:01'),(67,20210421112652,1,'2020-01-01 01:01:01'),(68,20210506095025,1,'2020-01-01 01:01:01'),(69,20210513115729,1,'2020-01-01 01:01:01'),(70,20210526113559,1,'2020-01-01 01:01:01'),(71,20210601000001,1,'2020-01-01 01:01:01'),(72,20210601000002,1,'2020-01-01 01:01:01'),(73,20210601000003,1,'2020-01-01 01:01:01'),(74,20210601000004,1,'2020-01-01 01:01:01'),(75,20210601000005,1,'2020-01-01 01:01:01'),(76,20210601000006,1,'2020-01-01 01:01:01'),(77,20210601000007,1,'2020-01-01 01:01:01'),(78,20210601000008,1,'2020-01-01 01:01:01'),(79,20210606151329,1,'2020-01-01 01:01:01'),(80,20210616163757,1,'2020-01-01 01:01:01'),(81,20210617174723,1,'2020-01-01 01:01:01'),(82,20210622160235,1,'2020-01-01 01:01:01'),(83,20210623100031,1,'2020-01-01 01:01:01'),(84,20210623133615,1,'2020-01-01 01:01:01'),(85,20210708143152,1,'2020-01-01 01:01:01'),(86,20210709124443,1,'2020-01-01 01:01:01'),(87,20210712155608,1,'2020-01-01 01:01:01'),(88,20210714102108,1,'2020-01-01 01:01:01'),(89,20210719153709,1,'2020-01-01 01:01:01'),(90,20210721171531,1,'2020-01-01 01:01:01'),(91,20210723135713,1,'2020-01-01 01:01:01'),(92,20210802135933,1,'2020-01-01 01:01:01'),(93,20210806112844,1,'2020-01-01 01:01:01'),(94,20210810095603,1,'2020-01-01 01:01:01'),(95,20210811150223,1,'2020-01-01 01:01:01'),(96,20210818151827,1,'2020-01-01 01:01:01'),(97,20210818151828,1,'2020-01-01 01:01:01'),(98,20210818182258,1,'2020-01-01 01:01:01'),(99,20210819131107,1,'2020-01-01 01:01:01'),(100,20210819143446,1,'2020-01-01 01:01:01'),(101,20210903132338,1,'2020-01-01 01:01:01'),(102,20210915144307,1,'2020-01-01 01:01:01'),(103,20210920155130,1,'2020-01-01 01:01:01'),(104,20210927143115,1,'2020-01-01 01:01:01'),(105,20210927143116,1,'2020-01-01 01:01:01'),(106,20211013133706,1,'2020-01-01 01:01:01'),(107,20211013133707,1,'2020-01-01 01:01:01'),(108,20211102135149,1,'2020-01-01 01:01:01'),(109,20211109121546,1,'2020-01-01 01:01:01'),(110,20211110163320,1,'2020-01-01 01:01:01'),(111,20211116184029,1,'2020-01-01 01:01:01'),(112,20211116184030,1,'2020-01-01 01:01:01'),(113,20211202092042,1,'2020-01-01 01:01:01'),(114,20211202181033,1,'2020-01-01 01:01:01'),(115,20211207161856,1,'2020-01-01 01:01:01'),(116,20211216131203,1,'2020-01-01 01:01:01'),(117,20211221110132,1,'2020-01-01 01:01:01'),(118,20220107155700,1,'2020-01-01 01:01:01'),(119,20220125105650,1,'2020-01-01 01:01:01'),(120,20220201084510,1,'2020-01-01 01:01:01'),(121,20220208144830,1,'2020-01-01 01:01:01'),(122,20220208144831,1,'2020-01-01 01:01:01'),(123,20220215152203,1,'2020-01-01 01:01:01'),(124,20220223113157,1,'2020-01-01 01:01:01'),(125,20220307104655,1,'2020-01-01 01:01:01'),(126,20220309133956,1,'2020-01-01 01:01:01'),(127,20220316155700,1,'2020-01-01 01:01:01'),(128,20220323152301,1,'2020-01-01 01:01:01'),(129,20220330100659,1,'2020-01-01 01:01:01'),(130,20220404091216,1,'2020-01-01 01:01:01'),(131,20220419140750,1,'2020-01-01 01:01:01'),(132,20220428140039,1,'2020-01-01 01:01:01'),(133,20220503134048,1,'2020-01-01 01:01:01'),(134,20220524102918,1,'2020-01-01 01:01:01'),(135,20220526123327,1,'2020-01-01 01:01:01'),(136,20220526123328,1,'2020-01-01 01:01:01'),(137,20220526123329,1,'2020-01-01 01:01:01'),(138,20220608113128,1,'2020-01-01 01:01:01'),(139,20220627104817,1,'2020-01-01 01:01:01'),(140,20220704101843,1,'2020-01-01 01:01:01'),(141,20220708095046,1,'2020-01-01 01:01:01'),(142,20220713091130,1,'2020-01-01 01:01:01'),(143,20220802135510,1,'2020-01-01 01:01:01'),(144,20220818101352,1,'2020-01-01 01:01:01'),(145,20220822161445,1,'2020-01-01 01:01:01'),(146,20220831100036,1,'2020-01-01 01:01:01'),(147,20220831100151,1,'2020-01-01 01:01:01'),(148,20220908181826,1,'2020-01-01 01:01:01'),(149,20220914154915,1,'2020-01-01 01:01:01'),(150,20220915165115,1,'2020-01-01 01:01:01'),(151,20220915165116,1,'2020-01-01 01:01:01'),(152,20220928100158,1,'2020-01-01 01:01:01'),(153,20221014084130,1,'2020-01-01 01:01:01'),(154,20221027085019,1,'2020-01-01 01:01:01'),(155,20221101103952,1,'2020-01-01 01:01:01'),(156,20221104144401,1,'2020-01-01 01:01:01'),(157,20221109100749,1,'2020-01-01 01:01:01'),(158,20221115104546,1,'2020-01-01 01:01:01'),(159,20221130114928,1,'2020-01-01 01:01:01'),(160,20221205112142,1,'2020-01-01 01:01:01'),(161,20221216115820,1,'2020-01-01 01:01:01'),(162,20221220195934,1,'2020-01-01 01:01:01'),(163,20221220195935,1,'2020-01-01 01:01:01'),(164,20221223174807,1,'2020-01-01 01:01:01'),(165,20221227163855,1,'2020-01-01 01:01:01'),(166,20221227163856,1,'2020-01-01 01:01:01'),(167,20230202224725,1,'2020-01-01 01:01:01'),(168,20230206163608,1,'2020-01-01 01:01:01'),(169,20230214131519,1,'2020-01-01 01:01:01'),(170,20230303135738,1,'2020-01-01 01:01:01'),(171,20230313135301,1,'2020-01-01 01:01:01'),(172,20230313141819,1,'2020-01-01 01:01:01'),(173,20230315104937,1,'2020-01-01 01:01:01'),(174,20230317173844,1,'2020-01-01 01:01:01'),(175,20230320133602,1,'2020-01-01 01:01:01'),(176,20230330100011,1,'2020-01-01 01:01:01'),(177,20230330134823,1,'2020-01-01 01:01:01'),(178,20230405232025,1,'2020-01-01 01:01:01'),(179,20230408084104,1,'2020-01-01 01:01:01'),(180,20230411102858,1,'2020-01-01 01:01:01'),(181,20230421155932,1,'2020-01-01 01:01:01'),(182,20230425082126,1,'2020-01-01 01:01:01'),(183,20230425105727,1,'2020-01-01 01:01:01'),(184,20230501154913,1,'2020-01-01 01:01:01'),(185,20230503101418,1,'2020-01-01 01:01:01'),(186,20230515144206,1,'2020-01-01 01:01:01'),(187,20230517140952,1,'2020-01-01 01:01:01'),(188,20230517152807,1,'2020-01-01 01:01:01'),(189,20230518114155,1,'2020-01-01 01:01:01'),(190,20230520153236,1,'2020-01-01 01:01:01'),(191,20230525151159,1,'2020-01-01 01:01:01'),(192,20230530122103,1,'2020-01-01 01:01:01'),(193,20230602111827,1,'2020-01-01 01:01:01'),(194,20230608103123,1,'2020-01-01 01:01:01'),(195,20230629140529,1,'2020-01-01 01:01:01'),(196,20230629140530,1,'2020-01-01 01:01:01'),(197,20230711144622,1,'2020-01-01 01:01:01'),(198,20230721135421,1,'2020-01-01 01:01:01'),(199,20230721161508,1,'2020-01-01 01:01:01'),(200,20230726115701,1,'2020-01-01 01:01:01'),(201,20230807100822,1,'2020-01-01 01:01:01'),(202,20230814150442,1,'2020-01-01 01:01:01'),(203,20230823122728,1,'2020-01-01 01:01:01'),(204,20230906152143,1,'2020-01-01 01:01:01'),(205,20230911163618,1,'2020-01-01 01:01:01'),(206,20230912101759,1,'2020-01-01 01:01:01'),(207,20230915101341,1,'2020-01-01 01:01:01'),(208,20230918132351,1,'2020-01-01 01:01:01'),(209,20231004144339,1,'2020-01-01 01:01:01'),(210,20231009094541,1,'2020-01-01 01:01:01'),(211,20231009094542,1,'2020-01-01 01:01:01'),(212,20231009094543,1,'2020-01-01 01:01:01'),(213,20231009094544,1,'2020-01-01 01:01:01'),(214,20231016091915,1,'2020-01-01 01:01:01'),(215,20231024174135,1,'2020-01-01 01:01:01'),(216,20231025120016,1,'2020-01-01 01:01:01'),(217,20231025160156,1,'2020-01-01 01:01:01'),(218,20231031165350,1,'2020-01-01 01:01:01'),(219,20231106144110,1,'2020-01-01 01:01:01'),(220,20231107130934,1,'2020-01-01 01:01:01'),(221,20231109115838,1,'2020-01-01 01:01:01'),(222,20231121054530,1,'2020-01-01 01:01:01'),(223,20231122101320,1,'2020-01-01 01:01:01'),(224,20231130132828,1,'2020-01-01 01:01:01'),(225,20231130132931,1,'2020-01-01 01:01:01'),(226,20231204155427,1,'2020-01-01 01:01:01'),(227,20231206142340,1,'2020-01-01 01:01:01'),(228,20231207102320,1,'2020-01-01 01:01:01'),(229,20231207102321,1,'2020-01-01 01:01:01'),(230,20231207133731,1,'2020-01-01 01:01:01'),(231,20231212094238,1,'2020-01-01 01:01:01'),(232,20231212095734,1,'2020-01-01 01:01:01'),(233,20231212161121,1,'2020-01-01 01:01:01'),(234,20231215122713,1,'2020-01-01 01:01:01'),(235,20231219143041,1,'2020-01-01 01:01:01'),(236,20231224070653,1,'2020-01-01 01:01:01'),(237,20240110134315,1,'2020-01-01 01:01:01'),(238,20240119091637,1,'2020-01-01 01:01:01'),(239,20240126020642,1,'2020-01-01 01:01:01'),(240,20240126020643,1,'2020-01-01 01:01:01'),(241,20240129162819,1,'2020-01-01 01:01:01'),(242,20240130115133,1,'2020-01-01 01:01:01'),(243,20240131083822,1,'2020-01-01 01:01:01'),(244,20240205095928,1,'2020-01-01 01:01:01'),(245,20240205121956,1,'2020-01-01 01:01:01'),(246,20240209110212,1,'2020-01-01 01:01:01'),(247,20240212111533,1,'2020-01-01 01:01:01'),(248,20240221112844,1,'2020-01-01 01:01:01'),(249,20240222073518,1,'2020-01-01 01:01:01'),(250,20240222135115,1,'2020-01-01 01:01:01'),(251,20240226082255,1,'2020-01-01 01:01:01'),(252,20240228082706,1,'2020-01-01 01:01:01'),(253,20240301173035,1,'2020-01-01 01:01:01'),(254,20240302111134,1,'2020-01-01 01:01:01'),(255,20240312103753,1,'2020-01-01 01:01:01'),(256,20240313143416,1,'2020-01-01 01:01:01'),(257,20240314085226,1,'2020-01-01 01:01:01'),(258,20240314151747,1,'2020-01-01 01:01:01'),(259,20240320145650,1,'2020-01-01 01:01:01'),(260,20240327115530,1,'2020-01-01 01:01:01'),(261,20240327115617,1,'2020-01-01 01:01:01'),(262,20240408085837,1,'2020-01-01 01:01:01'),(263,20240415104633,1,'2020-01-01 01:01:01'),(264,20240430111727,1,'2020-01-01 01:01:01'),(265,20240515200020,1,'2020-01-01 01:01:01'),(266,20240521143023,1,'2020-01-01 01:01:01'),(267,20240521143024,1,'2020-01-01 01:01:01'),(268,20240601174138,1,'2020-01-01 01:01:01'),(269,20240607133721,1,'2020-01-01 01:01:01'),(270,20240612150059,1,'2020-01-01 01:01:01'),(271,20240613162201,1,'2020-01-01 01:01:01'),(272,20240613172616,1,'2020-01-01 01:01:01'),(273,20240618142419,1,'2020-01-01 01:01:01'),(274,20240625093543,1,'2020-01-01 01:01:01'),(275,20240626195531,1,'2020-01-01 01:01:01'),(276,20240702123921,1,'2020-01-01 01:01:01'),(277,20240703154849,1,'2020-01-01 01:01:01'),(278,20240707134035,1,'2020-01-01 01:01:01'),(279,20240707134036,1,'2020-01-01 01:01:01'),(280,20240709124958,1,'2020-01-01 01:01:01'),(281,20240709132642,1,'2020-01-01 01:01:01'),(282,20240709183940,1,'2020-01-01 01:01:01'),(283,20240710155623,1,'2020-01-01 01:01:01'),(284,20240723102712,1,'2020-01-01 01:01:01'),(285,20240725152735,1,'2020-01-01 01:01:01'),(286,20240725182118,1,'2020-01-01 01:01:01'),(287,20240726100517,1,'2020-01-01 01:01:01'),(288,20240730171504,1,'2020-01-01 01:01:01'),(289,20240730174056,1,'2020-01-01 01:01:01'),(290,20240730215453,1,'2020-01-01 01:01:01'),(291,20240730374423,1,'2020-01-01 01:01:01'),(292,20240801115359,1,'2020-01-01 01:01:01'),(293,20240802101043,1,'2020-01-01 01:01:01'),(294,20240802113716,1,'2020-01-01 01:01:01'),(295,20240814135330,1,'2020-01-01 01:01:01'),(296,20240815000000,1,'2020-01-01 01:01:01'),(297,20240815000001,1,'2020-01-01 01:01:01'),(298,20240816103247,1,'2020-01-01 01:01:01'),(299,20240820091218,1,'2020-01-01 01:01:01'),(300,20240826111228,1,'2020-01-01 01:01:01'),(301,20240826160025,1,'2020-01-01 01:01:01'),(302,20240829165448,1,'2020-01-01 01:01:01'),(303,20240829165605,1,'2020-01-01 01:01:01'),(304,20240829165715,1,'2020-01-01 01:01:01'),(305,20240829165930,1,'2020-01-01 01:01:01'),(306,20240829170023,1,'2020-01-01 01:01:01'),(307,20240829170033,1,'2020-01-01 01:01:01'),(308,20240829170044,1,'2020-01-01 01:01:01'),(309,20240905105135,1,'2020-01-01 01:01:01'),(310,20240905140514,1,'2020-01-01 01:01:01'),(311,20240905200000,1,'2020-01-01 01:01:01'),(312,20240905200001,1,'2020-01-01 01:01:01'),(313,20241002104104,1,'2020-01-01 01:01:01'),(314,20241002104105,1,'2020-01-01 01:01:01'),(315,20241002104106,1,'2020-01-01 01:01:01'),(316,20241002210000,1,'2020-01-01 01:01:01'),(317,20241003145349,1,'2020-01-01 01:01:01'),(318,20241004005000,1,'2020-01-01 01:01:01'),(319,20241008083925,1,'2020-01-01 01:01:01'),(320,20241009090010,1,'2020-01-01 01:01:01'),(321,20241017163402,1,'2020-01-01 01:01:01'),(322,20241021224359,1,'2020-01-01 01:01:01'),(323,20241022140321,1,'2020-01-01 01:01:01'),(324,20241025111236,1,'2020-01-01 01:01:01'),(325,20241025112748,1,'2020-01-01 01:01:01'),(326,20241025141855,1,'2020-01-01 01:01:01'),(327,20241110152839,1,'2020-01-01 01:01:01'),(328,20241110152840,1,'2020-01-01 01:01:01'),(329,20241110152841,1,'2020-01-01 01:01:01'),(330,20241116233322,1,'2020-01-01 01:01:01'),(331,20241122171434,1,'2020-01-01 01:01:01'),(332,20241125150614,1,'2020-01-01 01:01:01'),(333,20241203125346,1,'2020-01-01 01:01:01'),(334,20241203130032,1,'2020-01-01 01:01:01'),(335,20241205122800,1,'2020-01-01 01:01:01'),(336,20241209164540,1,'2020-01-01 01:01:01'),(337,20241210140021,1,'2020-01-01 01:01:01'),(338,20241219180042,1,'2020-01-01 01:01:01'),(339,20241220100000,1,'2020-01-01 01:01:01'),(340,20241220114903,1,'2020-01-01 01:01:01'),(341,20241220114904,1,'2020-01-01 01:01:01'),(342,20241224000000,1,'2020-01-01 01:01:01'),(343,20241230000000,1,'2020-01-01 01:01:01'),(344,20241231112624,1,'2020-01-01 01:01:01'),(345,20250102121439,1,'2020-01-01 01:01:01'),(346,20250121094045,1,'2020-01-01 01:01:01'),(347,20250121094500,1,'2020-01-01 01:01:01'),(348,20250121094600,1,'2020-01-01 01:01:01'),(349,20250121094700,1,'2020-01-01 01:01:01'),(350,20250124194347,1,'2020-01-01 01:01:01'),(351,20250127162751,1,'2020-01-01 01:01:01'),(352,20250213104005,1,'2020-01-01 01:01:01'),(353,20250214205657,1,'2020-01-01 01:01:01'),(354,20250217093329,1,'2020-01-01 01:01:01'),(355,20250219090511,1,'2020-01-01 01:01:01'),(356,20250219100000,1,'2020-01-01 01:01:01'),(357,20250219142401,1,'2020-01-01 01:01:01'),(358,20250224184002,1,'2020-01-01 01:01:01'),(359,20250225085436,1,'2020-01-01 01:01:01'),(360,20250226000000,1,'2020-01-01 01:01:01'),(361,20250226153445,1,'2020-01-01 01:01:01'),(362,20250304162702,1,'2020-01-01 01:01:01'),(363,20250306144233,1,'2020-01-01 01:01:01'),(364,20250313163430,1,'2020-01-01 01:01:01'),(365,20250317130944,1,'2020-01-01 01:01:01'),(366,20250318165922,1,'2020-01-01 01:01:01'),(367,20250320132525,1,'2020-01-01 01:01:01'),(368,20250320200000,1,'2020-01-01 01:01:01'),(369,20250326161930,1,'2020-01-01 01:01:01'),(370,20250326161931,1,'2020-01-01 01:01:01'),(371,20250331042354,1,'2020-01-01 01:01:01'),(372,20250331154206,1,'2020-01-01 01:01:01'),(373,20250401155831,1,'2020-01-01 01:01:01'),(374,20250408133233,1,'2020-01-01 01:01:01'),(375,20250410104321,1,'2020-01-01 01:01:01'),(376,20250421085116,1,'2020-01-01 01:01:01'),(377,20250422095806,1,'2020-01-01 01:01:01'),(378,20250424153059,1,'2020-01-01 01:01:01'),(379,20250430103833,1,'2020-01-01 01:01:01'),(380,20250430112622,1,'2020-01-01 01:01:01'),(381,20250501162727,1,'2020-01-01 01:01:01'),(382,20250502154517,1,'2020-01-01 01:01:01'),(383,20250502222222,1,'2020-01-01 01:01:01'),(384,20250507170845,1,'2020-01-01 01:01:01'),(385,20250513162912,1,'2020-01-01 01:01:01'),(386,20250519161614,1,'2020-01-01 01:01:01'),(387,20250519170000,1,'2020-01-01 01:01:01'),(388,20250520153848,1,'2020-01-01 01:01:01'),(389,20250528115932,1,'2020-01-01 01:01:01'),(390,20250529102706,1,'2020-01-01 01:01:01'),(391,20250603105558,1,'2020-01-01 01:01:01'),(392,20250609102714,1,'2020-01-01 01:01:01'),(393,20250609112613,1,'2020-01-01 01:01:01'),(394,20250613103810,1,'2020-01-01 01:01:01'),(395,20250616193950,1,'2020-01-01 01:01:01'),(396,20250624140757,1,'2020-01-01 01:01:01'),(397,20250626130239,1,'2020-01-01 01:01:01'),(398,20250629131032,1,'2020-01-01 01:01:01'),(399,20250701155654,1,'2020-01-01 01:01:01'),(400,20250707095725,1,'2020-01-01 01:01:01'),(401,20250716152435,1,'2020-01-01 01:01:01'),(402,20250718091828,1,'2020-01-01 01:01:01'),(403,20250728122229,1,'2020-01-01 01:01:01'),(404,20250731122715,1,'2020-01-01 01:01:01'),(405,20250731151000,1,'2020-01-01 01:01:01'),(406,20250803000000,1,'2020-01-01 01:01:01'),(407,20250805083116,1,'2020-01-01 01:01:01'),(408,20250807140441,1,'2020-01-01 01:01:01'),(409,20250808000000,1,'2020-01-01 01:01:01'),(410,20250811155036,1,'2020-01-01 01:01:01'),(411,20250813205039,1,'2020-01-01 01:01:01'),(412,20250814123333,1,'2020-01-01 01:01:01'),(413,20250815130115,1,'2020-01-01 01:01:01'),(414,20250816115553,1,'2020-01-01 01:01:01'),(415,20250817154557,1,'2020-01-01 01:01:01'),(416,20250825113751,1,'2020-01-01 01:01:01'),(417,20250827113140,1,'2020-01-01 01:01:01'),(418,20250828120836,1,'2020-01-01 01:01:01'),(419,20250902112642,1,'2020-01-01 01:01:01'),(420,20250904091745,1,'2020-01-01 01:01:01'),(421,20250905090000,1,'2020-01-01 01:01:01'),(422,20250922083056,1,'2020-01-01 01:01:01'),(423,20250923120000,1,'2020-01-01 01:01:01'),(424,20250926123048,1,'2020-01-01 01:01:01'),(425,20251015103505,1,'2020-01-01 01:01:01'),(426,20251015103600,1,'2020-01-01 01:01:01'),(427,20251015103700,1,'2020-01-01 01:01:01'),(428,20251015103800,1,'2020-01-01 01:01:01'),(429,20251015103900,1,'2020-01-01 01:01:01'),(430,20251028140000,1,'2020-01-01 01:01:01'),(431,20251028140100,1,'2020-01-01 01:01:01'),(432,20251028140110,1,'2020-01-01 01:01:01'),(433,20251028140200,1,'2020-01-01 01:01:01'),(434,20251028140300,1,'2020-01-01 01:01:01'),(435,20251028140400,1,'2020-01-01 01:01:01'),(436,20251031154558,1,'2020-01-01 01:01:01'),(437,20251103160848,1,'2020-01-01 01:01:01'),(438,20251104112849,1,'2020-01-01 01:01:01'),(439,20251106000000,1,'2020-01-01 01:01:01'),(440,20251107164629,1,'2020-01-01 01:01:01'),(441,20251107170854,1,'2020-01-01 01:01:01'),(442,20251110172137,1,'2020-01-01 01:01:01'),(443,20251111153133,1,'2020-01-01 01:01:01'),(444,20251117020000,1,'2020-01-01 01:01:01'),(445,20251117020100,1,'2020-01-01 01:01:01'),(446,20251117020200,1,'2020-01-01 01:01:01'),(447,20251121100000,1,'2020-01-01 01:01:01'),(448,20251121124239,1,'2020-01-01 01:01:01'),(449,20251124090450,1,'2020-01-01 01:01:01'),(450,20251124135808,1,'2020-01-01 01:01:01'),(451,20251124140138,1,'2020-01-01 01:01:01'),(452,20251124162948,1,'2020-01-01 01:01:01'),(453,20251127113559,1,'2020-01-01 01:01:01'),(454,20251202162232,1,'2020-01-01 01:01:01'),(455,20251203170808,1,'2020-01-01 01:01:01'),(456,20251207050413,1,'2020-01-01 01:01:01'),(457,20251208215800,1,'2020-01-01 01:01:01'),(458,20251209221730,1,'2020-01-01 01:01:01'),(459,20251209221850,1,'2020-01-01 01:01:01'),(460,20251215163721,1,'2020-01-01 01:01:01'),(461,20251217000000,1,'2020-01-01 01:01:01'),(462,20251217120000,1,'2020-01-01 01:01:01'),(463,20251229000000,1,'2020-01-01 01:01:01'),(464,20251229000010,1,'2020-01-01 01:01:01'),(465,20251229000020,1,'2020-01-01 01:01:01'),(466,20260106000000,1,'2020-01-01 01:01:01'),(467,20260108200708,1,'2020-01-01 01:01:01'),(468,20260108214732,1,'2020-01-01 01:01:01'),(469,20260109231821,1,'2020-01-01 01:01:01'),(470,20260113012054,1,'2020-01-01 01:01:01'),(471,20260124200020,1,'2020-01-01 01:01:01'),(472,20260126150840,1,'2020-01-01 01:01:01'),(473,20260126210724,1,'2020-01-01 01:01:01'),(474,20260202151756,1,'2020-01-01 01:01:01'),(475,20260205184907,1,'2020-01-01 01:01:01'),(476,20260210151544,1,'2020-01-01 01:01:01'),(477,20260210155109,1,'2020-01-01 01:01:01'),(478,20260210181120,1,'2020-01-01 01:01:01'),(479,20260211200153,1,'2020-01-01 01:01:01'),(480,20260217141240,1,'2020-01-01 01:01:01'),(481,20260217200906,1,'2020-01-01 01:01:01'),(482,20260218175704,1,'2020-01-01 01:01:01'),(483,20260314120000,1,'2020-01-01 01:01:01'),(484,20260316120000,1,'2020-01-01 01:01:01'),(485,20260316120001,1,'2020-01-01 01:01:01'),(486,20260316120002,1,'2020-01-01 01:01:01'),(487,20260316120003,1,'2020-01-01 01:01:01'),(488,20260316120004,1,'2020-01-01 01:01:01'),(489,20260316120005,1,'2020-01-01 01:01:01'),(490,20260316120006,1,'2020-01-01 01:01:01'),(491,20260316120007,1,'2020-01-01 01:01:01'),(492,20260316120008,1,'2020-01-01 01:01:01'),(493,20260316120009,1,'2020-01-01 01:01:01'),(494,20260316120010,1,'2020-01-01 01:01:01'),(495,20260317120000,1,'2020-01-01 01:01:01'),(496,20260318184559,1,'2020-01-01 01:01:01'),(497,20260319120000,1,'2020-01-01 01:01:01'),(498,20260323144117,1,'2020-01-01 01:01:01'),(499,20260324161944,1,'2020-01-01 01:01:01'),(500,20260324223334,1,'2020-01-01 01:01:01'),(501,20260326131501,1,'2020-01-01 01:01:01'),(502,20260326210603,1,'2020-01-01 01:01:01'),(503,20260331000000,1,'2020-01-01 01:01:01'),(504,20260401153000,1,'2020-01-01 01:01:01'),(505,20260401153001,1,'2020-01-01 01:01:01'),(506,20260401153503,1,'2020-01-01 01:01:01'),(507,20260403120000,1,'2020-01-01 01:01:01'),(508,20260409153713,1,'2020-01-01 01:01:01'),(509,20260409153714,1,'2020-01-01 01:01:01'),(510,20260409153715,1,'2020-01-01 01:01:01'),(511,20260409153716,1,'2020-01-01 01:01:01'),(512,20260409153717,1,'2020-01-01 01:01:01'),(513,20260409183610,1,'2020-01-01 01:01:01'),(514,20260410173222,1,'2020-01-01 01:01:01'),(515,20260422181702,1,'2020-01-01 01:01:01'),(516,20260423161823,1,'2020-01-01 01:01:01'),(517,20260423161824,1,'2020-01-01 01:01:01'),(518,20260518194422,1,'2020-01-01 01:01:01'),(519,20260522195224,1,'2020-01-01 01:01:01'),(520,20260522195225,1,'2020-01-01 01:01:01'),(521,20260522195226,1,'2020-01-01 01:01:01'),(522,20260522195227,1,'2020-01-01 01:01:01'),(523,20260522195229,1,'2020-01-01 01:01:01'),(524,20260522195230,1,'2020-01-01 01:01:01'),(525,20260522195231,1,'2020-01-01 01:01:01'),(526,20260522195232,1,'2020-01-01 01:01:01'),(527,20260522195233,1,'2020-01-01 01:01:01'),(528,20260522195234,1,'2020-01-01 01:01:01'),(529,20260522195235,1,'2020-01-01 01:01:01'),(530,20260527215817,1,'2020-01-01 01:01:01'),(531,20260527215818,1,'2020-01-01 01:01:01'),(532,20260528201143,1,'2020-01-01 01:01:01'),(533,20260528201150,1,'2020-01-01 01:01:01'),(534,20260528211626,1,'2020-01-01 01:01:01'),(535,20260528213326,1,'2020-01-01 01:01:01'),(536,20260529091823,1,'2020-01-01 01:01:01'),(537,20260529120000,1,'2020-01-01 01:01:01'),(538,20260601200727,1,'2020-01-01 01:01:01'),(539,20260603101320,1,'2020-01-01 01:01:01'),(540,20260603120000,1,'2020-01-01 01:01:01'),(541,20260604221206,1,'2020-01-01 01:01:01'),(542,20260605195941,1,'2020-01-01 01:01:01'),(543,20260606051849,1,'2020-01-01 01:01:01'),(544,20260608160653,1,'2020-01-01 01:01:01'),(545,20260608202705,1,'2020-01-01 01:01:01'),(546,20260608210432,1,'2020-01-01 01:01:01'),(547,20260610172952,1,'2020-01-01 01:01:01'),(548,20260624210253,1,'2020-01-01 01:01:01'),(549,20260624210311,1,'2020-01-01 01:01:01'),(550,20260626120000,1,'2020-01-01 01:01:01'),(551,20260702013055,1,'2020-01-01 01:01:01'),(552,20260702013056,1,'2020-01-01 01:01:01'),(553,20260702013057,1,'2020-01-01 01:01:01'),(554,20260702013058,1,'2020-01-01 01:01:01'),(555,20260702013059,1,'2020-01-01 01:01:01'),(556,20260702013100,1,'2020-01-01 01:01:01'),(557,20260702013101,1,'2020-01-01 01:01:01'),(558,20260702013102,1,'2020-01-01 01:01:01'),(559,20260702164518,1,'2020-01-01 01:01:01'),(560,20260717152653,1,'2020-01-01 01:01:01'),(561,20260723181401,1,'2020-01-01 01:01:01'),(562,20260723181402,1,'2020-01-01 01:01:01'),(563,20260723181403,1,'2020-01-01 01:01:01'),(564,20260723181404,1,'2020-01-01 01:01:01'),(565,20260723181405,1,'2020-01-01 01:01:01'),(566,20260723181406,1,'2020-01-01 01:01:01'),(567,20260723181407,1,'2020-01-01 01:01:01'),(568,20260723181408,1,'2020-01-01 01:01:01'),(569,20260723181409,1,'2020-01-01 01:01:01'),(570,20260723181410,1,'2020-01-01 01:01:01'),(571,20260723181411,1,'2020-01-01 01:01:01'),(572,20260723181412,1,'2020-01-01 01:01:01'),(573,20260723181413,1,'2020-01-01 01:01:01'),(574,20260724010000,1,'2020-01-01 01:01:01'),(575,20260724134801,1,'2020-01-01 01:01:01'),(576,20260727083533,1,'2020-01-01 01:01:01'),(577,20260727084359,1,'2020-01-01 01:01:01'),(578,20260729110229,1,'2020-01-01 01:01:01'),(579,20260729115013,1,'2020-01-01 01:01:01'),(580,20260731213352,1,'2020-01-01 01:01:01'),(581,20260803135530,1,'2020-01-01 01:01:01'),(582,20260803182251,1,'2020-01-01 01:01:01'),(583,20260805161502,1,'2020-01-01 01:01:01'),(584,20260806154139,1,'2020-01-01 01:01:01'),(585,20260806154150,1,'2020-01-01 01:01:01'),(586,20260806210232,1,'2020-01-01 01:01:01'),(587,20260807120050,1,'2020-01-01 01:01:01'),(588,20260807140831,1,'2020-01-01 01:01:01'),(589,20260807151355,1,'2020-01-01 01:01:01'),(590,20260810152924,1,'2020-01-01 01:01:01'),(591,20260810160000,1,'2020-01-01 01:01:01'),(592,20260810192005,1,'2020-01-01 01:01:01'),(593,20260812083512,1,'2020-01-01 01:01:01'),(594,20260812134345,1,'2020-01-01 01:01:01'),(595,20260814183816,1,'2020-01-01 01:01:01'),(596,20260817080402,1,'2020-01-01 01:01:01'),(597,20260817110708,1,'2020-01-01 01:01:01'),(598,20260818171921,1,'2020-01-01 01:01:01'),(599,20260818182457,1,'2020-01-01 01:01:01'),(600,20260821182648,1,'2020-01-01 01:01:01'),(601,20260821201620,1,'2020-01-01 01:01:01'),(602,20260822030354,1,'2020-01-01 01:01:01'),(603,20260825213833,1,'2020-01-01 01:01:01'),(604,20260827170502,1,'2020-01-01 01:01:01'),(605,20260828172118,1,'2020-01-01 01:01:01'),(606,20260831190535,1,'2020-01-01 01:01:01'),(607,20260901192408,1,'2020-01-01 01:01:01'),(608,20260901200001,1,'2020-01-01 01:01:01'),(609,20260901200002,1,'2020-01-01 01:01:01'),(610,20260902083032,1,'2020-01-01 01:01:01'),(611,20260902091843,1,'2020-01-01 01:01:01'),(612,20260902124249,1,'2020-01-01 01:01:01'),(613,20260902140128,1,'2020-01-01 01:01:01'),(614,20260902140158,1,'2020-01-01 01:01:01'),(615,20260902140230,1,'2020-01-01 01:01:01'),(616,20260902150237,1,'2020-01-01 01:01:01'),(617,20260904202219,1,'2020-01-01 01:01:01'),(618,20260908152437,1,'2020-01-01 01:01:01'),(619,20260908164600,1,'2020-01-01 01:01:01'),(620,20260909074539,1,'2020-01-01 01:01:01'),(621,20260909142539,1,'2020-01-01 01:01:01'),(622,20260910153522,1,'2020-01-01 01:01:01'),(623,20260910194211,1,'2020-01-01 01:01:01'),(624,20260916091319,1,'2020-01-01 01:01:01'),(625,20260916143823,1,'2020-01-01 01:01:01'),(626,20260916145443,1,'2020-01-01 01:01:01'),(627,20260916150929,1,'2020-01-01 01:01:01'),(628,20260921141651,1,'2020-01-01 01:01:01'),(629,20260921165359,1,'2020-01-01 01:01:01'),(630,20260921170000,1,'2020-01-01 01:01:01'),(631,20260921170001,1,'2020-01-01 01:01:01'),(632,20260921170002,1,'2020-01-01 01:01:01'),(633,20260922041729,1,'2020-01-01 01:01:01'),(634,20260922041731,1,'2020-01-01 01:01:01'),(635,20260922041732,1,'2020-01-01 01:01:01'),(636,20260922041733,1,'2020-01-01 01:01:01'),(637,20260922164155,1,'2020-01-01 01:01:01'),(638,20260923061611,1,'2020-01-01 01:01:01'),(639,20260923180303,1,'2020-01-01 01:01:01'),(640,20260923183241,1,'2020-01-01 01:01:01'),(641,20260924203815,1,'2020-01-01 01:01:01'); /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mobile_device_management_solutions` ( diff --git a/server/fleet/android.go b/server/fleet/android.go index bea6a9555d7..b27950e590b 100644 --- a/server/fleet/android.go +++ b/server/fleet/android.go @@ -28,6 +28,7 @@ type MDMAndroidConfigProfile struct { ProfileUUID string `db:"profile_uuid" json:"profile_uuid"` TeamID *uint `db:"team_id" json:"team_id" renameto:"fleet_id"` Name string `db:"name" json:"name"` + Description string `db:"description" json:"description"` RawJSON []byte `db:"raw_json" json:"-"` AutoIncrement int64 `db:"auto_increment" json:"auto_increment"` LabelsIncludeAll []ConfigurationProfileLabel `db:"-" json:"labels_include_all,omitempty"` diff --git a/server/fleet/apple_mdm.go b/server/fleet/apple_mdm.go index f8f38e9bcce..4fe6dc252e5 100644 --- a/server/fleet/apple_mdm.go +++ b/server/fleet/apple_mdm.go @@ -240,6 +240,9 @@ type MDMAppleConfigProfile struct { // Name corresponds to the payload display name of the associated mobileconfig payload. // Fleet requires that Name must be unique in combination with the Identifier and TeamID. Name string `db:"name" json:"name"` + // Description is free text written by the admin. It is not part of the + // checksum, so changing it never re-delivers the profile. + Description string `db:"description" json:"description"` // Mobileconfig is the byte slice corresponding to the XML property list (i.e. plist) // representation of the configuration profile. It must be XML or PKCS7 parseable. Mobileconfig mobileconfig.Mobileconfig `db:"mobileconfig" json:"-"` @@ -952,6 +955,10 @@ type MDMAppleDeclaration struct { // Fleet requires that Name must be unique in combination with the Identifier and TeamID. Name string `db:"name" json:"name"` + // Description is free text written by the admin. It is not part of the + // token, so changing it never re-delivers the declaration. + Description string `db:"description" json:"description"` + // Scope is the channel the declaration is delivered on, parsed from the // declaration's top-level PayloadScope. "System" (the default) targets the // device channel; "User" targets the user channel (macOS only). diff --git a/server/fleet/mdm.go b/server/fleet/mdm.go index 4d79ff8b38e..ffd5ef6a4c7 100644 --- a/server/fleet/mdm.go +++ b/server/fleet/mdm.go @@ -683,6 +683,7 @@ type MDMConfigProfilePayload struct { ProfileUUID string `json:"profile_uuid" db:"profile_uuid"` TeamID *uint `json:"team_id" renameto:"fleet_id" db:"team_id"` // null for no-team Name string `json:"name" db:"name"` + Description string `json:"description" db:"description"` Platform string `json:"platform" db:"platform"` // "windows", "android" or "darwin" Identifier string `json:"identifier,omitempty" db:"identifier"` // only set for macOS Scope string `json:"scope,omitempty" db:"scope"` // only set for macOS, can be "System" or "User" @@ -714,8 +715,9 @@ type BatchModifyMDMConfigProfilePayload struct { // MDMProfileBatchPayload represents the payload to batch-set the profiles for // a team or no-team. type MDMProfileBatchPayload struct { - Name string `json:"name,omitempty"` - Contents []byte `json:"contents,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + Contents []byte `json:"contents,omitempty"` // Deprecated: Labels is the backwards-compatible way of specifying // LabelsIncludeAll. @@ -738,6 +740,7 @@ func NewMDMConfigProfilePayloadFromWindows(cp *MDMWindowsConfigProfile) *MDMConf ProfileUUID: cp.ProfileUUID, TeamID: tid, Name: cp.Name, + Description: cp.Description, Platform: "windows", CreatedAt: cp.CreatedAt, UploadedAt: cp.UploadedAt, @@ -756,6 +759,7 @@ func NewMDMConfigProfilePayloadFromApple(cp *MDMAppleConfigProfile) *MDMConfigPr ProfileUUID: cp.ProfileUUID, TeamID: tid, Name: cp.Name, + Description: cp.Description, Identifier: cp.Identifier, Platform: "darwin", Checksum: cp.Checksum, @@ -777,6 +781,7 @@ func NewMDMConfigProfilePayloadFromAppleDDM(decl *MDMAppleDeclaration) *MDMConfi ProfileUUID: decl.DeclarationUUID, TeamID: tid, Name: decl.Name, + Description: decl.Description, Identifier: decl.Identifier, Platform: "darwin", Checksum: []byte(decl.Token), @@ -801,6 +806,7 @@ func NewMDMConfigProfilePayloadFromAndroid(cp *MDMAndroidConfigProfile) *MDMConf ProfileUUID: cp.ProfileUUID, TeamID: tid, Name: cp.Name, + Description: cp.Description, Platform: "android", CreatedAt: cp.CreatedAt, UploadedAt: cp.UploadedAt, diff --git a/server/fleet/windows_mdm.go b/server/fleet/windows_mdm.go index 3adb4a795b5..bb9e1488955 100644 --- a/server/fleet/windows_mdm.go +++ b/server/fleet/windows_mdm.go @@ -39,6 +39,7 @@ type MDMWindowsConfigProfile struct { ProfileUUID string `db:"profile_uuid" json:"profile_uuid"` TeamID *uint `db:"team_id" json:"team_id" renameto:"fleet_id"` Name string `db:"name" json:"name"` + Description string `db:"description" json:"description"` SyncML []byte `db:"syncml" json:"-"` LabelsIncludeAll []ConfigurationProfileLabel `db:"-" json:"labels_include_all,omitempty"` LabelsIncludeAny []ConfigurationProfileLabel `db:"-" json:"labels_include_any,omitempty"` diff --git a/server/service/apple_mdm.go b/server/service/apple_mdm.go index aa30138ddbb..23d3efb5472 100644 --- a/server/service/apple_mdm.go +++ b/server/service/apple_mdm.go @@ -1209,6 +1209,8 @@ func (svc *Service) updateMDMAppleDeclaration(ctx context.Context, profileUUID s } decl.LabelsExcludeAny = excludeLabels } + // Not settable through this endpoint yet, so carry the stored value. + decl.Description = existing.Description // Three states: an edit that doesn't mention the activation keeps the stored // one, a null one removes it, and content replaces it. The datastore write @@ -1934,6 +1936,8 @@ func (svc *Service) updateMDMAppleConfigProfile(ctx context.Context, profileUUID cp.LabelsExcludeAny = excludeLabels } cp.ProfileUUID = profileUUID + // Not settable through this endpoint yet, so carry the stored value. + cp.Description = existing.Description if _, err := svc.ds.UpdateMDMAppleConfigProfile(ctx, *cp, varNames); err != nil { if _, ok := errors.AsType[endpointer.ExistsErrorInterface](err); ok { diff --git a/server/service/mdm.go b/server/service/mdm.go index 1795dfbece9..7b987070bc8 100644 --- a/server/service/mdm.go +++ b/server/service/mdm.go @@ -2422,6 +2422,8 @@ func (svc *Service) updateMDMAndroidConfigProfile(ctx context.Context, profileUU cp.LabelsExcludeAny = excludeLabels } cp.ProfileUUID = profileUUID + // Not settable through this endpoint yet, so carry the stored value. + cp.Description = existing.Description if _, err := svc.ds.UpdateMDMAndroidConfigProfile(ctx, *cp, varNames); err != nil { return ctxerr.Wrap(ctx, err) @@ -3122,6 +3124,7 @@ func getAppleProfiles( } mdmDecl := fleet.NewMDMAppleDeclaration(prof.Contents, tmID, prof.Name, rawDecl.Type, rawDecl.Identifier) + mdmDecl.Description = prof.Description mdmDecl.SecretsUpdatedAt = prof.SecretsUpdatedAt // PayloadScope is a Fleet extension (not part of Apple's DDM schema). The // parsed value drives the scope column; the key stays in the stored JSON @@ -3187,6 +3190,7 @@ func getAppleProfiles( fleet.NewInvalidArgumentError(prof.Name, err.Error()), "invalid mobileconfig profile") } + mdmProf.Description = prof.Description mdmProf.SecretsUpdatedAt = prof.SecretsUpdatedAt for _, labelName := range prof.LabelsIncludeAll { @@ -3282,9 +3286,10 @@ func getWindowsProfiles( } mdmProf := &fleet.MDMWindowsConfigProfile{ - TeamID: tmID, - Name: profile.Name, - SyncML: profile.Contents, + TeamID: tmID, + Name: profile.Name, + Description: profile.Description, + SyncML: profile.Contents, } for _, labelName := range profile.LabelsIncludeAll { if lbl, ok := labelMap[labelName]; ok { @@ -3356,9 +3361,10 @@ func getAndroidProfiles(ctx context.Context, continue } mdmProf := &fleet.MDMAndroidConfigProfile{ - TeamID: tmID, - Name: profile.Name, - RawJSON: profile.Contents, + TeamID: tmID, + Name: profile.Name, + Description: profile.Description, + RawJSON: profile.Contents, } for _, labelName := range profile.LabelsIncludeAll { if lbl, ok := labelMap[labelName]; ok { diff --git a/server/service/windows_mdm_profiles.go b/server/service/windows_mdm_profiles.go index 5cafcf587df..35aab77e7ec 100644 --- a/server/service/windows_mdm_profiles.go +++ b/server/service/windows_mdm_profiles.go @@ -230,6 +230,8 @@ func (svc *Service) updateMDMWindowsConfigProfile(ctx context.Context, profileUU cp.LabelsExcludeAny = excludeLabels } cp.ProfileUUID = profileUUID + // Not settable through this endpoint yet, so carry the stored value. + cp.Description = existing.Description if _, err := svc.ds.UpdateMDMWindowsConfigProfile(ctx, *cp, usesFleetVars); err != nil { if _, ok := errors.AsType[endpointer.ExistsErrorInterface](err); ok { From 58850b2d7b45d8af559cfe346ff71eb5a776b79c Mon Sep 17 00:00:00 2001 From: Matias Spinarolli Date: Thu, 24 Sep 2026 18:35:25 -0300 Subject: [PATCH 2/7] Fix description gaps found in review The Apple-only list and identifier lookups now select description. The batch payload stops accepting it from JSON until the API change adds its length validation. --- server/datastore/mysql/apple_mdm.go | 2 ++ server/datastore/mysql/mdm_test.go | 8 ++++++++ server/fleet/mdm.go | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/server/datastore/mysql/apple_mdm.go b/server/datastore/mysql/apple_mdm.go index 61121b9266b..f9eda2b5a75 100644 --- a/server/datastore/mysql/apple_mdm.go +++ b/server/datastore/mysql/apple_mdm.go @@ -495,6 +495,7 @@ SELECT profile_id, team_id, name, + description, scope, identifier, mobileconfig, @@ -945,6 +946,7 @@ SELECT profile_id, team_id, name, + description, scope, identifier, mobileconfig, diff --git a/server/datastore/mysql/mdm_test.go b/server/datastore/mysql/mdm_test.go index 6bdb66d72f2..32fce8a7f69 100644 --- a/server/datastore/mysql/mdm_test.go +++ b/server/datastore/mysql/mdm_test.go @@ -2001,6 +2001,14 @@ func testMDMConfigProfilesDescription(t *testing.T, ds *Datastore) { require.NoError(t, err) require.Equal(t, "android desc", gotAndroid.Description) + appleListed, err := ds.ListMDMAppleConfigProfiles(ctx, nil) + require.NoError(t, err) + require.Len(t, appleListed, 1) + require.Equal(t, "apple desc", appleListed[0].Description) + byIdent, err := ds.GetMDMAppleConfigProfileByTeamAndIdentifier(ctx, nil, apple.Identifier) + require.NoError(t, err) + require.Equal(t, "apple desc", byIdent.Description) + listed, _, err := ds.ListMDMConfigProfiles(ctx, nil, opts) require.NoError(t, err) require.Len(t, listed, 4) diff --git a/server/fleet/mdm.go b/server/fleet/mdm.go index ffd5ef6a4c7..994961d4ef7 100644 --- a/server/fleet/mdm.go +++ b/server/fleet/mdm.go @@ -716,7 +716,7 @@ type BatchModifyMDMConfigProfilePayload struct { // a team or no-team. type MDMProfileBatchPayload struct { Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` + Description string `json:"-"` Contents []byte `json:"contents,omitempty"` // Deprecated: Labels is the backwards-compatible way of specifying From 4594e7a81472a778d11ab0ed38ccdae5d2f72b68 Mon Sep 17 00:00:00 2001 From: Matias Spinarolli Date: Mon, 28 Sep 2026 10:37:14 -0300 Subject: [PATCH 3/7] Clarify the description-only update comment --- server/datastore/mysql/android.go | 3 ++- server/datastore/mysql/microsoft_mdm.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/datastore/mysql/android.go b/server/datastore/mysql/android.go index e75fbd6b63d..8fd8628d88d 100644 --- a/server/datastore/mysql/android.go +++ b/server/datastore/mysql/android.go @@ -1002,7 +1002,8 @@ func (ds *Datastore) UpdateMDMAndroidConfigProfile(ctx context.Context, cp fleet } } else { // Description is not part of the checksum, so it is written without - // touching uploaded_at. The row is known to exist from the SELECT above. + // touching uploaded_at. Zero affected rows only means it was unchanged: + // the SELECT above already confirmed the profile exists. if _, err := tx.ExecContext(ctx, `UPDATE mdm_android_configuration_profiles SET description = ? WHERE profile_uuid = ?`, cp.Description, cp.ProfileUUID); err != nil { diff --git a/server/datastore/mysql/microsoft_mdm.go b/server/datastore/mysql/microsoft_mdm.go index 660f5f86153..4e33118096d 100644 --- a/server/datastore/mysql/microsoft_mdm.go +++ b/server/datastore/mysql/microsoft_mdm.go @@ -3406,7 +3406,8 @@ WHERE profile_uuid = ?` } } else { // Description is not part of the checksum, so it is written without - // touching uploaded_at. The row is known to exist from the SELECT above. + // touching uploaded_at. Zero affected rows only means it was unchanged: + // the SELECT above already confirmed the profile exists. if _, err := tx.ExecContext(ctx, `UPDATE mdm_windows_configuration_profiles SET description = ? WHERE profile_uuid = ?`, cp.Description, cp.ProfileUUID); err != nil { From a957b0d061ab166c4e9c7badb256f6b99c0017dd Mon Sep 17 00:00:00 2001 From: Matias Spinarolli Date: Mon, 28 Sep 2026 10:37:44 -0300 Subject: [PATCH 4/7] Wrap the description-only update comment --- server/datastore/mysql/android.go | 4 ++-- server/datastore/mysql/microsoft_mdm.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/datastore/mysql/android.go b/server/datastore/mysql/android.go index 8fd8628d88d..2122502dd69 100644 --- a/server/datastore/mysql/android.go +++ b/server/datastore/mysql/android.go @@ -1002,8 +1002,8 @@ func (ds *Datastore) UpdateMDMAndroidConfigProfile(ctx context.Context, cp fleet } } else { // Description is not part of the checksum, so it is written without - // touching uploaded_at. Zero affected rows only means it was unchanged: - // the SELECT above already confirmed the profile exists. + // touching uploaded_at. Zero affected rows only means it was + // unchanged: the SELECT above already confirmed the profile exists. if _, err := tx.ExecContext(ctx, `UPDATE mdm_android_configuration_profiles SET description = ? WHERE profile_uuid = ?`, cp.Description, cp.ProfileUUID); err != nil { diff --git a/server/datastore/mysql/microsoft_mdm.go b/server/datastore/mysql/microsoft_mdm.go index 4e33118096d..713f3369469 100644 --- a/server/datastore/mysql/microsoft_mdm.go +++ b/server/datastore/mysql/microsoft_mdm.go @@ -3406,8 +3406,8 @@ WHERE profile_uuid = ?` } } else { // Description is not part of the checksum, so it is written without - // touching uploaded_at. Zero affected rows only means it was unchanged: - // the SELECT above already confirmed the profile exists. + // touching uploaded_at. Zero affected rows only means it was + // unchanged: the SELECT above already confirmed the profile exists. if _, err := tx.ExecContext(ctx, `UPDATE mdm_windows_configuration_profiles SET description = ? WHERE profile_uuid = ?`, cp.Description, cp.ProfileUUID); err != nil { From 3b8ab08fe94de06da765b0a30dc0e47a49536dd2 Mon Sep 17 00:00:00 2001 From: Matias Spinarolli Date: Mon, 28 Sep 2026 10:57:38 -0300 Subject: [PATCH 5/7] Cleanup --- server/datastore/mysql/mdm_test.go | 2 -- .../20260925182345_AddDescriptionToMDMConfigurationProfiles.go | 3 --- server/service/apple_mdm.go | 2 -- server/service/mdm.go | 1 - server/service/windows_mdm_profiles.go | 1 - 5 files changed, 9 deletions(-) diff --git a/server/datastore/mysql/mdm_test.go b/server/datastore/mysql/mdm_test.go index 754ebdab540..d4c2ee74438 100644 --- a/server/datastore/mysql/mdm_test.go +++ b/server/datastore/mysql/mdm_test.go @@ -1963,7 +1963,6 @@ func testMDMConfigProfilesDescription(t *testing.T, ds *Datastore) { ctx := t.Context() opts := fleet.ListOptions{OrderKey: "name"} - // create one profile of each type with a description apple, err := ds.NewMDMAppleConfigProfile(ctx, fleet.MDMAppleConfigProfile{ Name: "apple", Identifier: "com.example.apple", @@ -1993,7 +1992,6 @@ func testMDMConfigProfilesDescription(t *testing.T, ds *Datastore) { require.NoError(t, err) require.Equal(t, "android desc", android.Description) - // get and list return the description for every type gotApple, err := ds.GetMDMAppleConfigProfile(ctx, apple.ProfileUUID) require.NoError(t, err) require.Equal(t, "apple desc", gotApple.Description) diff --git a/server/datastore/mysql/migrations/tables/20260925182345_AddDescriptionToMDMConfigurationProfiles.go b/server/datastore/mysql/migrations/tables/20260925182345_AddDescriptionToMDMConfigurationProfiles.go index 601d2319113..375dd28bb70 100644 --- a/server/datastore/mysql/migrations/tables/20260925182345_AddDescriptionToMDMConfigurationProfiles.go +++ b/server/datastore/mysql/migrations/tables/20260925182345_AddDescriptionToMDMConfigurationProfiles.go @@ -9,9 +9,6 @@ func init() { MigrationClient.AddMigration(Up_20260925182345, Down_20260925182345) } -// Free text written by the admin, shown next to the profile name. Same shape -// as teams.description. It is deliberately not part of any checksum or token -// so that editing it never re-delivers the profile. func Up_20260925182345(tx *sql.Tx) error { for _, table := range []string{ "mdm_apple_configuration_profiles", diff --git a/server/service/apple_mdm.go b/server/service/apple_mdm.go index 03829f34f64..263c763b17e 100644 --- a/server/service/apple_mdm.go +++ b/server/service/apple_mdm.go @@ -1209,7 +1209,6 @@ func (svc *Service) updateMDMAppleDeclaration(ctx context.Context, profileUUID s } decl.LabelsExcludeAny = excludeLabels } - // Not settable through this endpoint yet, so carry the stored value. decl.Description = existing.Description // Three states: an edit that doesn't mention the activation keeps the stored @@ -1936,7 +1935,6 @@ func (svc *Service) updateMDMAppleConfigProfile(ctx context.Context, profileUUID cp.LabelsExcludeAny = excludeLabels } cp.ProfileUUID = profileUUID - // Not settable through this endpoint yet, so carry the stored value. cp.Description = existing.Description if _, err := svc.ds.UpdateMDMAppleConfigProfile(ctx, *cp, varNames); err != nil { diff --git a/server/service/mdm.go b/server/service/mdm.go index 7b987070bc8..a02748d0526 100644 --- a/server/service/mdm.go +++ b/server/service/mdm.go @@ -2422,7 +2422,6 @@ func (svc *Service) updateMDMAndroidConfigProfile(ctx context.Context, profileUU cp.LabelsExcludeAny = excludeLabels } cp.ProfileUUID = profileUUID - // Not settable through this endpoint yet, so carry the stored value. cp.Description = existing.Description if _, err := svc.ds.UpdateMDMAndroidConfigProfile(ctx, *cp, varNames); err != nil { diff --git a/server/service/windows_mdm_profiles.go b/server/service/windows_mdm_profiles.go index 35aab77e7ec..d6104779d55 100644 --- a/server/service/windows_mdm_profiles.go +++ b/server/service/windows_mdm_profiles.go @@ -230,7 +230,6 @@ func (svc *Service) updateMDMWindowsConfigProfile(ctx context.Context, profileUU cp.LabelsExcludeAny = excludeLabels } cp.ProfileUUID = profileUUID - // Not settable through this endpoint yet, so carry the stored value. cp.Description = existing.Description if _, err := svc.ds.UpdateMDMWindowsConfigProfile(ctx, *cp, usesFleetVars); err != nil { From 7c8351454fa398acf7613eb5ad40305a743785fb Mon Sep 17 00:00:00 2001 From: Matias Spinarolli Date: Mon, 28 Sep 2026 16:56:39 -0300 Subject: [PATCH 6/7] Clarify the batch description test comment --- server/datastore/mysql/mdm_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/datastore/mysql/mdm_test.go b/server/datastore/mysql/mdm_test.go index 84d38067b3d..f136433460d 100644 --- a/server/datastore/mysql/mdm_test.go +++ b/server/datastore/mysql/mdm_test.go @@ -2074,7 +2074,7 @@ func testMDMConfigProfilesDescription(t *testing.T, ds *Datastore) { require.Equal(t, gotAndroid.UploadedAt, updAndroid.UploadedAt) // the batch path writes the description too, and a description-only - // change there is not reported as an update to the profiles' content + // change there leaves uploaded_at alone, so nothing is re-delivered bApple := generateAppleCP("batch-apple", "com.example.batch-apple", 0) bApple.Description = "batch apple" bDecl := declForTest("batch-decl", "batch-decl", "batch-decl") From 4c21fa9e7ece3dcb87395bf0e8f9ee45ea180d28 Mon Sep 17 00:00:00 2001 From: Matias Spinarolli Date: Tue, 29 Sep 2026 12:34:04 -0300 Subject: [PATCH 7/7] Skip unchanged description writes and fix tests --- server/datastore/mysql/android.go | 18 +++--- server/datastore/mysql/android_test.go | 32 ++++++++++ server/datastore/mysql/apple_mdm.go | 20 ++----- server/datastore/mysql/apple_mdm_test.go | 53 +++++++++++++++++ server/datastore/mysql/mdm_test.go | 61 ++++---------------- server/datastore/mysql/microsoft_mdm.go | 20 ++++--- server/datastore/mysql/microsoft_mdm_test.go | 34 +++++++++++ 7 files changed, 160 insertions(+), 78 deletions(-) diff --git a/server/datastore/mysql/android.go b/server/datastore/mysql/android.go index 9b126f76dbd..3c6b72afb95 100644 --- a/server/datastore/mysql/android.go +++ b/server/datastore/mysql/android.go @@ -967,10 +967,11 @@ func (ds *Datastore) GetMDMAndroidConfigProfile(ctx context.Context, profileUUID func (ds *Datastore) UpdateMDMAndroidConfigProfile(ctx context.Context, cp fleet.MDMAndroidConfigProfile, usesFleetVars []fleet.FleetVarName) (*fleet.MDMAndroidConfigProfile, error) { err := ds.withTx(ctx, func(tx sqlx.ExtContext) error { var existing struct { - Name string `db:"name"` + Name string `db:"name"` + Description string `db:"description"` } err := sqlx.GetContext(ctx, tx, &existing, - `SELECT name FROM mdm_android_configuration_profiles WHERE profile_uuid = ?`, cp.ProfileUUID) + `SELECT name, description FROM mdm_android_configuration_profiles WHERE profile_uuid = ?`, cp.ProfileUUID) if err != nil { if err == sql.ErrNoRows { return ctxerr.Wrap(ctx, notFound("MDMAndroidConfigProfile").WithName(cp.ProfileUUID)) @@ -1007,15 +1008,18 @@ func (ds *Datastore) UpdateMDMAndroidConfigProfile(ctx context.Context, cp fleet }, "android", false); err != nil { return ctxerr.Wrap(ctx, err, "updating android profile variable associations") } - } else { + } else if existing.Description != cp.Description { // Description is not part of the checksum, so it is written without - // touching uploaded_at. Zero affected rows only means it was - // unchanged: the SELECT above already confirmed the profile exists. - if _, err := tx.ExecContext(ctx, + // touching uploaded_at. + res, err := tx.ExecContext(ctx, `UPDATE mdm_android_configuration_profiles SET description = ? WHERE profile_uuid = ?`, - cp.Description, cp.ProfileUUID); err != nil { + cp.Description, cp.ProfileUUID) + if err != nil { return ctxerr.Wrap(ctx, err, "updating android mdm config profile description") } + if aff, _ := res.RowsAffected(); aff == 0 { + return ctxerr.Wrap(ctx, notFound("MDMAndroidConfigProfile").WithName(cp.ProfileUUID)) + } } labels := make([]fleet.ConfigurationProfileLabel, 0, len(cp.LabelsIncludeAll)+len(cp.LabelsIncludeAny)+len(cp.LabelsExcludeAny)) diff --git a/server/datastore/mysql/android_test.go b/server/datastore/mysql/android_test.go index d376908b349..65cb9cd26cf 100644 --- a/server/datastore/mysql/android_test.go +++ b/server/datastore/mysql/android_test.go @@ -1180,6 +1180,38 @@ func testUpdateMDMAndroidConfigProfile(t *testing.T, ds *Datastore) { }, nil) require.NoError(t, err) require.Greater(t, contentChangedProf.UploadedAt.Year(), 2020, "a content change must bump uploaded_at") + + // the description isn't part of the checksum, so changing it alone must + // not bump uploaded_at, while it is still written with a content change + ExecAdhocSQL(t, ds, func(q sqlx.ExtContext) error { + _, err := q.ExecContext(ctx, `UPDATE mdm_android_configuration_profiles SET uploaded_at = '2020-01-01 00:00:00' WHERE profile_uuid = ?`, uploadedAtProfile.ProfileUUID) + return err + }) + // the repeat covers the skipped write when the description is unchanged + for _, desc := range []string{"new description", "new description"} { + _, err = ds.UpdateMDMAndroidConfigProfile(ctx, fleet.MDMAndroidConfigProfile{ + ProfileUUID: uploadedAtProfile.ProfileUUID, + Name: uploadedAtProfile.Name, + Description: desc, + }, nil) + require.NoError(t, err) + stored, err = ds.GetMDMAndroidConfigProfile(ctx, uploadedAtProfile.ProfileUUID) + require.NoError(t, err) + require.Equal(t, desc, stored.Description) + require.Equal(t, 2020, stored.UploadedAt.Year(), "a description-only edit must not bump uploaded_at") + } + + _, err = ds.UpdateMDMAndroidConfigProfile(ctx, fleet.MDMAndroidConfigProfile{ + ProfileUUID: uploadedAtProfile.ProfileUUID, + Name: uploadedAtProfile.Name, + Description: "description with content", + RawJSON: []byte(`{"uploadedAt": "described"}`), + }, nil) + require.NoError(t, err) + stored, err = ds.GetMDMAndroidConfigProfile(ctx, uploadedAtProfile.ProfileUUID) + require.NoError(t, err) + require.Equal(t, "description with content", stored.Description) + require.Greater(t, stored.UploadedAt.Year(), 2020, "a content change must bump uploaded_at") } func testMDMAndroidProfilesSummary(t *testing.T, ds *Datastore) { diff --git a/server/datastore/mysql/apple_mdm.go b/server/datastore/mysql/apple_mdm.go index 52a4aac6861..d553c9a4f9b 100644 --- a/server/datastore/mysql/apple_mdm.go +++ b/server/datastore/mysql/apple_mdm.go @@ -299,11 +299,12 @@ INSERT INTO func (ds *Datastore) UpdateMDMAppleConfigProfile(ctx context.Context, cp fleet.MDMAppleConfigProfile, usesFleetVars []fleet.FleetVarName) (*fleet.MDMAppleConfigProfile, error) { err := ds.withTx(ctx, func(tx sqlx.ExtContext) error { var existing struct { - Identifier string `db:"identifier"` - Name string `db:"name"` + Identifier string `db:"identifier"` + Name string `db:"name"` + Description string `db:"description"` } err := sqlx.GetContext(ctx, tx, &existing, - `SELECT identifier, name FROM mdm_apple_configuration_profiles WHERE profile_uuid = ?`, cp.ProfileUUID) + `SELECT identifier, name, description FROM mdm_apple_configuration_profiles WHERE profile_uuid = ?`, cp.ProfileUUID) if err != nil { if err == sql.ErrNoRows { return ctxerr.Wrap(ctx, notFound("MDMAppleConfigProfile").WithName(cp.ProfileUUID)) @@ -376,7 +377,7 @@ WHERE profile_uuid = ? AND identifier = ?` if aff, _ := res.RowsAffected(); aff == 0 { return ctxerr.Wrap(ctx, notFound("MDMAppleConfigProfile").WithName(cp.ProfileUUID)) } - } else { + } else if existing.Description != cp.Description { // Description is not part of the checksum, so it is written without // touching uploaded_at: a bump would re-verify every installed copy. res, err := tx.ExecContext(ctx, @@ -386,16 +387,7 @@ WHERE profile_uuid = ? AND identifier = ?` return ctxerr.Wrap(ctx, err, "updating apple mdm config profile description") } if aff, _ := res.RowsAffected(); aff == 0 { - // 0 rows also means "unchanged", so only fail when the row is gone. - var exists bool - if err := sqlx.GetContext(ctx, tx, &exists, - `SELECT EXISTS (SELECT 1 FROM mdm_apple_configuration_profiles WHERE profile_uuid = ?)`, - cp.ProfileUUID); err != nil { - return ctxerr.Wrap(ctx, err, "checking apple mdm config profile exists") - } - if !exists { - return ctxerr.Wrap(ctx, notFound("MDMAppleConfigProfile").WithName(cp.ProfileUUID)) - } + return ctxerr.Wrap(ctx, notFound("MDMAppleConfigProfile").WithName(cp.ProfileUUID)) } } diff --git a/server/datastore/mysql/apple_mdm_test.go b/server/datastore/mysql/apple_mdm_test.go index 8f90110f7bf..0e89ef89858 100644 --- a/server/datastore/mysql/apple_mdm_test.go +++ b/server/datastore/mysql/apple_mdm_test.go @@ -695,6 +695,42 @@ func testUpdateMDMAppleConfigProfile(t *testing.T, ds *Datastore) { }, nil) require.NoError(t, err) require.Greater(t, contentChangedProf.UploadedAt.Year(), 2020, "a content change must bump uploaded_at") + + // the description isn't part of the checksum, so changing it alone must + // not bump uploaded_at, while it is still written with a content change + ExecAdhocSQL(t, ds, func(q sqlx.ExtContext) error { + _, err := q.ExecContext(ctx, `UPDATE mdm_apple_configuration_profiles SET uploaded_at = '2020-01-01 00:00:00' WHERE profile_uuid = ?`, uploadedAtProfile.ProfileUUID) + return err + }) + // the repeat covers the skipped write when the description is unchanged + for _, desc := range []string{"new description", "new description"} { + _, err = ds.UpdateMDMAppleConfigProfile(ctx, fleet.MDMAppleConfigProfile{ + ProfileUUID: uploadedAtProfile.ProfileUUID, + Identifier: uploadedAtProfile.Identifier, + TeamID: uploadedAtProfile.TeamID, + Description: desc, + }, nil) + require.NoError(t, err) + storedCP, err = ds.GetMDMAppleConfigProfile(ctx, uploadedAtProfile.ProfileUUID) + require.NoError(t, err) + require.Equal(t, desc, storedCP.Description) + require.Equal(t, 2020, storedCP.UploadedAt.Year(), "a description-only edit must not bump uploaded_at") + require.Equal(t, contentChangedProf.Checksum, storedCP.Checksum) + } + + _, err = ds.UpdateMDMAppleConfigProfile(ctx, fleet.MDMAppleConfigProfile{ + ProfileUUID: uploadedAtProfile.ProfileUUID, + Identifier: uploadedAtProfile.Identifier, + Name: "Uploaded At Profile Renamed", + TeamID: uploadedAtProfile.TeamID, + Description: "description with content", + Mobileconfig: mobileconfig.Mobileconfig([]byte("UploadedAtBytes v3")), + }, nil) + require.NoError(t, err) + storedCP, err = ds.GetMDMAppleConfigProfile(ctx, uploadedAtProfile.ProfileUUID) + require.NoError(t, err) + require.Equal(t, "description with content", storedCP.Description) + require.Greater(t, storedCP.UploadedAt.Year(), 2020) } func testVerifyAppleConfigProfileScopesDoNotConflict(t *testing.T, ds *Datastore) { @@ -7553,6 +7589,23 @@ func testSetOrUpdateMDMAppleDDMDeclaration(t *testing.T, ds *Datastore) { d1tm1B, err = ds.GetMDMAppleDeclaration(ctx, d1tm1B.DeclarationUUID) require.NoError(t, err) require.Equal(t, d1tm1B.DeclarationUUID, d1tm1.DeclarationUUID) + + // the description isn't part of the token, so changing it alone must not + // bump uploaded_at or the token, which would make hosts re-sync + ExecAdhocSQL(t, ds, func(q sqlx.ExtContext) error { + _, err := q.ExecContext(ctx, `UPDATE mdm_apple_declarations SET uploaded_at = '2020-01-01 00:00:00' WHERE declaration_uuid = ?`, d1tm1B.DeclarationUUID) + return err + }) + before, err := ds.GetMDMAppleDeclaration(ctx, d1tm1B.DeclarationUUID) + require.NoError(t, err) + before.Description = "new description" + _, err = ds.SetOrUpdateMDMAppleDeclaration(ctx, before, nil, fleet.MDMAppleActivationKeep) + require.NoError(t, err) + described, err := ds.GetMDMAppleDeclaration(ctx, d1tm1B.DeclarationUUID) + require.NoError(t, err) + require.Equal(t, "new description", described.Description) + require.Equal(t, 2020, described.UploadedAt.Year(), "a description-only edit must not bump uploaded_at") + require.Equal(t, before.Token, described.Token) } func testDeleteMDMAppleDeclarationWithPendingInstalls(t *testing.T, ds *Datastore) { diff --git a/server/datastore/mysql/mdm_test.go b/server/datastore/mysql/mdm_test.go index f136433460d..44e5225ffc3 100644 --- a/server/datastore/mysql/mdm_test.go +++ b/server/datastore/mysql/mdm_test.go @@ -2027,52 +2027,6 @@ func testMDMConfigProfilesDescription(t *testing.T, ds *Datastore) { "windows": "windows desc", }, descByName) - // a description-only update must not move uploaded_at: it is not part of - // the checksum, so nothing is re-delivered - _, err = ds.UpdateMDMAppleConfigProfile(ctx, fleet.MDMAppleConfigProfile{ - ProfileUUID: apple.ProfileUUID, - Identifier: apple.Identifier, - Name: apple.Name, - Description: "apple desc 2", - }, nil) - require.NoError(t, err) - updApple, err := ds.GetMDMAppleConfigProfile(ctx, apple.ProfileUUID) - require.NoError(t, err) - require.Equal(t, "apple desc 2", updApple.Description) - require.Equal(t, gotApple.UploadedAt, updApple.UploadedAt) - require.Equal(t, gotApple.Checksum, updApple.Checksum) - - gotDecl.Description = "decl desc 2" - _, err = ds.SetOrUpdateMDMAppleDeclaration(ctx, gotDecl, nil, fleet.MDMAppleActivationKeep) - require.NoError(t, err) - updDecl, err := ds.GetMDMAppleDeclaration(ctx, decl.DeclarationUUID) - require.NoError(t, err) - require.Equal(t, "decl desc 2", updDecl.Description) - require.Equal(t, gotDecl.UploadedAt, updDecl.UploadedAt) - require.Equal(t, gotDecl.Token, updDecl.Token) - - _, err = ds.UpdateMDMWindowsConfigProfile(ctx, fleet.MDMWindowsConfigProfile{ - ProfileUUID: win.ProfileUUID, - Name: win.Name, - Description: "windows desc 2", - }, nil) - require.NoError(t, err) - updWin, err := ds.GetMDMWindowsConfigProfile(ctx, win.ProfileUUID) - require.NoError(t, err) - require.Equal(t, "windows desc 2", updWin.Description) - require.Equal(t, gotWin.UploadedAt, updWin.UploadedAt) - - _, err = ds.UpdateMDMAndroidConfigProfile(ctx, fleet.MDMAndroidConfigProfile{ - ProfileUUID: android.ProfileUUID, - Name: android.Name, - Description: "android desc 2", - }, nil) - require.NoError(t, err) - updAndroid, err := ds.GetMDMAndroidConfigProfile(ctx, android.ProfileUUID) - require.NoError(t, err) - require.Equal(t, "android desc 2", updAndroid.Description) - require.Equal(t, gotAndroid.UploadedAt, updAndroid.UploadedAt) - // the batch path writes the description too, and a description-only // change there leaves uploaded_at alone, so nothing is re-delivered bApple := generateAppleCP("batch-apple", "com.example.batch-apple", 0) @@ -2092,10 +2046,8 @@ func testMDMConfigProfilesDescription(t *testing.T, ds *Datastore) { require.NoError(t, err) require.Len(t, listed, 4) descByName = make(map[string]string, len(listed)) - uploadedAtByName := make(map[string]time.Time, len(listed)) for _, p := range listed { descByName[p.Name] = p.Description - uploadedAtByName[p.Name] = p.UploadedAt } require.Equal(t, map[string]string{ "batch-android": "batch android", @@ -2104,6 +2056,17 @@ func testMDMConfigProfilesDescription(t *testing.T, ds *Datastore) { "batch-windows": "batch windows", }, descByName) + // backdated, since uploaded_at only has one-second precision + for _, table := range []string{ + "mdm_apple_configuration_profiles", "mdm_apple_declarations", + "mdm_windows_configuration_profiles", "mdm_android_configuration_profiles", + } { + ExecAdhocSQL(t, ds, func(q sqlx.ExtContext) error { + _, err := q.ExecContext(ctx, `UPDATE `+table+` SET uploaded_at = '2020-01-01 00:00:00'`) + return err + }) + } + bApple.Description = "batch apple 2" bDecl.Description = "batch decl 2" bWin.Description = "batch windows 2" @@ -2118,7 +2081,7 @@ func testMDMConfigProfilesDescription(t *testing.T, ds *Datastore) { require.Len(t, listed, 4) for _, p := range listed { require.Equal(t, descByName[p.Name]+" 2", p.Description, p.Name) - require.Equal(t, uploadedAtByName[p.Name], p.UploadedAt, p.Name) + require.Equal(t, 2020, p.UploadedAt.Year(), p.Name) } } diff --git a/server/datastore/mysql/microsoft_mdm.go b/server/datastore/mysql/microsoft_mdm.go index 713f3369469..d6db1866419 100644 --- a/server/datastore/mysql/microsoft_mdm.go +++ b/server/datastore/mysql/microsoft_mdm.go @@ -3301,11 +3301,12 @@ func (ds *Datastore) UpdateMDMWindowsConfigProfile(ctx context.Context, cp fleet err := ds.withRetryTxx(ctx, func(tx sqlx.ExtContext) error { var existing struct { - Name string `db:"name"` - SyncML []byte `db:"syncml"` + Name string `db:"name"` + Description string `db:"description"` + SyncML []byte `db:"syncml"` } err := sqlx.GetContext(ctx, tx, &existing, - `SELECT name, syncml FROM mdm_windows_configuration_profiles WHERE profile_uuid = ?`, cp.ProfileUUID) + `SELECT name, description, syncml FROM mdm_windows_configuration_profiles WHERE profile_uuid = ?`, cp.ProfileUUID) if err != nil { if err == sql.ErrNoRows { return ctxerr.Wrap(ctx, notFound("MDMWindowsProfile").WithName(cp.ProfileUUID)) @@ -3404,15 +3405,18 @@ WHERE profile_uuid = ?` }, "windows", false); err != nil { return ctxerr.Wrap(ctx, err, "updating windows profile variable associations") } - } else { + } else if existing.Description != cp.Description { // Description is not part of the checksum, so it is written without - // touching uploaded_at. Zero affected rows only means it was - // unchanged: the SELECT above already confirmed the profile exists. - if _, err := tx.ExecContext(ctx, + // touching uploaded_at. + res, err := tx.ExecContext(ctx, `UPDATE mdm_windows_configuration_profiles SET description = ? WHERE profile_uuid = ?`, - cp.Description, cp.ProfileUUID); err != nil { + cp.Description, cp.ProfileUUID) + if err != nil { return ctxerr.Wrap(ctx, err, "updating windows mdm config profile description") } + if aff, _ := res.RowsAffected(); aff == 0 { + return ctxerr.Wrap(ctx, notFound("MDMWindowsProfile").WithName(cp.ProfileUUID)) + } } labels := make([]fleet.ConfigurationProfileLabel, 0, len(cp.LabelsIncludeAll)+len(cp.LabelsIncludeAny)+len(cp.LabelsExcludeAny)) diff --git a/server/datastore/mysql/microsoft_mdm_test.go b/server/datastore/mysql/microsoft_mdm_test.go index 7c5a6b24f5f..3c8ce6acde1 100644 --- a/server/datastore/mysql/microsoft_mdm_test.go +++ b/server/datastore/mysql/microsoft_mdm_test.go @@ -3350,6 +3350,40 @@ func testUpdateMDMWindowsConfigProfile(t *testing.T, ds *Datastore) { }, nil) require.NoError(t, err) require.Greater(t, contentChangedProf.UploadedAt.Year(), 2020, "a content change must bump uploaded_at") + + // the description isn't part of the checksum, so changing it alone must + // not bump uploaded_at, while it is still written with a content change + ExecAdhocSQL(t, ds, func(q sqlx.ExtContext) error { + _, err := q.ExecContext(ctx, `UPDATE mdm_windows_configuration_profiles SET uploaded_at = '2020-01-01 00:00:00' WHERE profile_uuid = ?`, uploadedAtProfile.ProfileUUID) + return err + }) + // the repeat covers the skipped write when the description is unchanged + for _, desc := range []string{"new description", "new description"} { + _, err = ds.UpdateMDMWindowsConfigProfile(ctx, fleet.MDMWindowsConfigProfile{ + ProfileUUID: uploadedAtProfile.ProfileUUID, + Name: uploadedAtProfile.Name, + Description: desc, + }, nil) + require.NoError(t, err) + stored, err = ds.GetMDMWindowsConfigProfile(ctx, uploadedAtProfile.ProfileUUID) + require.NoError(t, err) + require.Equal(t, desc, stored.Description) + require.Equal(t, 2020, stored.UploadedAt.Year(), "a description-only edit must not bump uploaded_at") + } + + describedSyncML := []byte("./Device/Vendor/MSFT/Test/Described") + _, err = ds.UpdateMDMWindowsConfigProfile(ctx, fleet.MDMWindowsConfigProfile{ + ProfileUUID: uploadedAtProfile.ProfileUUID, + Name: uploadedAtProfile.Name, + Description: "description with content", + SyncML: describedSyncML, + }, nil) + require.NoError(t, err) + stored, err = ds.GetMDMWindowsConfigProfile(ctx, uploadedAtProfile.ProfileUUID) + require.NoError(t, err) + require.Equal(t, "description with content", stored.Description) + require.Equal(t, describedSyncML, stored.SyncML) + require.Greater(t, stored.UploadedAt.Year(), 2020, "a content change must bump uploaded_at") } // identified by its (unique) name.