diff --git a/server/datastore/mysql/hosts.go b/server/datastore/mysql/hosts.go index e413fa239b..5246056554 100644 --- a/server/datastore/mysql/hosts.go +++ b/server/datastore/mysql/hosts.go @@ -542,6 +542,7 @@ var hostRefs = []string{ "host_mdm_actions", "host_calendar_events", "upcoming_activities", + "android_devices", } // NOTE: The following tables are explicity excluded from hostRefs list and accordingly are not diff --git a/server/datastore/mysql/hosts_test.go b/server/datastore/mysql/hosts_test.go index a7fb9b04e3..f065a34b7a 100644 --- a/server/datastore/mysql/hosts_test.go +++ b/server/datastore/mysql/hosts_test.go @@ -7055,6 +7055,13 @@ func testHostsDeleteHosts(t *testing.T, ds *Datastore) { require.NoError(t, err) require.True(t, added) + // create an android device from this host + _, err = ds.writer(context.Background()).Exec(` + INSERT INTO android_devices (host_id, device_id) + VALUES (?, ?); + `, host.ID, uuid.NewString()) + require.NoError(t, err) + // Check there's an entry for the host in all the associated tables. for _, hostRef := range hostRefs { var ok bool