mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Fix DB migration bug when adding MDM enroll tables (#29963)
This commit is contained in:
parent
65698e8d4b
commit
b216219c44
3 changed files with 15 additions and 12 deletions
3
changes/28860-fix-migration
Normal file
3
changes/28860-fix-migration
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
- Fixed an issue in the database migrations released in 4.68.0 where Apple devices with UDID values
|
||||
longer than 36 characters would cause a failure in the migration process; the `host_uuid` column
|
||||
for tables added by that migration has been increased to accommodate these longer UDID values.
|
||||
|
|
@ -26,7 +26,7 @@ func Up_20250502222222(tx *sql.Tx) error {
|
|||
createStmt := `
|
||||
CREATE TABLE IF NOT EXISTS legacy_host_mdm_enroll_refs (
|
||||
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
host_uuid VARCHAR(36) NOT NULL,
|
||||
host_uuid VARCHAR(255) NOT NULL,
|
||||
enroll_ref VARCHAR(36) NOT NULL,
|
||||
INDEX idx_legacy_enroll_refs_host_uuid (host_uuid)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
|
||||
|
|
@ -38,7 +38,7 @@ CREATE TABLE IF NOT EXISTS legacy_host_mdm_enroll_refs (
|
|||
createStmt += `
|
||||
CREATE TABLE IF NOT EXISTS legacy_host_mdm_idp_accounts (
|
||||
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
host_uuid VARCHAR(36) NOT NULL,
|
||||
host_uuid VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(255) NOT NULL,
|
||||
account_uuid VARCHAR(36) NULL,
|
||||
host_id INT UNSIGNED NULL,
|
||||
|
|
@ -55,7 +55,7 @@ CREATE TABLE IF NOT EXISTS legacy_host_mdm_idp_accounts (
|
|||
createStmt += `
|
||||
CREATE TABLE IF NOT EXISTS host_mdm_idp_accounts (
|
||||
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
host_uuid VARCHAR(36) NOT NULL,
|
||||
host_uuid VARCHAR(255) NOT NULL,
|
||||
account_uuid VARCHAR(36) NOT NULL DEFAULT '',
|
||||
created_at DATETIME (6) NOT NULL DEFAULT NOW(6),
|
||||
updated_at DATETIME (6) NOT NULL DEFAULT NOW(6) ON UPDATE NOW(6),
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ func TestUp_20250502222222(t *testing.T) {
|
|||
fmt.Sprintf("serial-%d", id),
|
||||
fmt.Sprintf("osquery-host-id-%d", id),
|
||||
fmt.Sprintf("node-key-%d", id),
|
||||
fmt.Sprintf("host-uuid-%d", id),
|
||||
fmt.Sprintf("host-uuid-extra-looooooooooooooooooooooooooooooong-%d", id),
|
||||
platform,
|
||||
))
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ func TestUp_20250502222222(t *testing.T) {
|
|||
{
|
||||
name: "host with unmatched url ref but mdm account email match",
|
||||
hostID: 1,
|
||||
hostUUID: "host-uuid-1",
|
||||
hostUUID: "host-uuid-extra-looooooooooooooooooooooooooooooong-1",
|
||||
hostMDM: hostMDM{
|
||||
HostID: 1,
|
||||
FleetEnrollRef: "nobody-uuid",
|
||||
|
|
@ -131,7 +131,7 @@ func TestUp_20250502222222(t *testing.T) {
|
|||
{
|
||||
name: "host with unmatched url ref but multiple mdm account email matches",
|
||||
hostID: 2,
|
||||
hostUUID: "host-uuid-2",
|
||||
hostUUID: "host-uuid-extra-looooooooooooooooooooooooooooooong-2",
|
||||
hostMDM: hostMDM{
|
||||
HostID: 2,
|
||||
FleetEnrollRef: "nobody-uuid",
|
||||
|
|
@ -150,7 +150,7 @@ func TestUp_20250502222222(t *testing.T) {
|
|||
{
|
||||
name: "host with legacy match and multiple mdm account email matches",
|
||||
hostID: 3,
|
||||
hostUUID: "host-uuid-3",
|
||||
hostUUID: "host-uuid-extra-looooooooooooooooooooooooooooooong-3",
|
||||
hostMDM: hostMDM{
|
||||
HostID: 3,
|
||||
FleetEnrollRef: "bob-uuid",
|
||||
|
|
@ -169,7 +169,7 @@ func TestUp_20250502222222(t *testing.T) {
|
|||
{
|
||||
name: "host with legacy match and no mdm account email matches",
|
||||
hostID: 4,
|
||||
hostUUID: "host-uuid-4",
|
||||
hostUUID: "host-uuid-extra-looooooooooooooooooooooooooooooong-4",
|
||||
hostMDM: hostMDM{
|
||||
HostID: 4,
|
||||
FleetEnrollRef: "bob-uuid",
|
||||
|
|
@ -184,7 +184,7 @@ func TestUp_20250502222222(t *testing.T) {
|
|||
{
|
||||
name: "host with no legacy match and no mdm account email matches",
|
||||
hostID: 5,
|
||||
hostUUID: "host-uuid-5",
|
||||
hostUUID: "host-uuid-extra-looooooooooooooooooooooooooooooong-5",
|
||||
hostMDM: hostMDM{
|
||||
HostID: 5,
|
||||
FleetEnrollRef: "nobody-uuid",
|
||||
|
|
@ -199,7 +199,7 @@ func TestUp_20250502222222(t *testing.T) {
|
|||
{
|
||||
name: "host with no legacy match and no mdm account emails",
|
||||
hostID: 6,
|
||||
hostUUID: "host-uuid-6",
|
||||
hostUUID: "host-uuid-extra-looooooooooooooooooooooooooooooong-6",
|
||||
hostMDM: hostMDM{
|
||||
HostID: 6,
|
||||
FleetEnrollRef: "nobody-uuid",
|
||||
|
|
@ -212,7 +212,7 @@ func TestUp_20250502222222(t *testing.T) {
|
|||
{
|
||||
name: "host with legacy match and no emails",
|
||||
hostID: 7,
|
||||
hostUUID: "host-uuid-7",
|
||||
hostUUID: "host-uuid-extra-looooooooooooooooooooooooooooooong-7",
|
||||
hostMDM: hostMDM{
|
||||
HostID: 7,
|
||||
FleetEnrollRef: "bob-uuid",
|
||||
|
|
@ -225,7 +225,7 @@ func TestUp_20250502222222(t *testing.T) {
|
|||
{
|
||||
name: "host with no legacy match and only google emails",
|
||||
hostID: 8,
|
||||
hostUUID: "host-uuid-8",
|
||||
hostUUID: "host-uuid-extra-looooooooooooooooooooooooooooooong-8",
|
||||
hostMDM: hostMDM{
|
||||
HostID: 8,
|
||||
FleetEnrollRef: "nobody-uuid",
|
||||
|
|
|
|||
Loading…
Reference in a new issue