From e52f6c8291822d5b0033daba7511c3240de8d842 Mon Sep 17 00:00:00 2001 From: Benjamin Edwards Date: Mon, 22 Jul 2024 11:23:44 -0400 Subject: [PATCH 1/7] update GCP terraform code to be compatible with software installers updates (#20585) --- .../fleet-server-configuration.md | 2 +- .../dogfood/terraform/gcp/.terraform.lock.hcl | 82 +++++++++++++++++++ .../terraform/gcp/artifact_registry.tf | 7 -- .../dogfood/terraform/gcp/cloud_run.tf | 71 +++++++++++++++- infrastructure/dogfood/terraform/gcp/main.tf | 2 +- .../dogfood/terraform/gcp/readme.md | 25 ------ .../dogfood/terraform/gcp/storage.tf | 23 ++++++ .../dogfood/terraform/gcp/variables.tf | 15 +++- infrastructure/dogfood/terraform/gcp/vpc.tf | 13 +++ 9 files changed, 204 insertions(+), 36 deletions(-) create mode 100644 infrastructure/dogfood/terraform/gcp/.terraform.lock.hcl delete mode 100644 infrastructure/dogfood/terraform/gcp/artifact_registry.tf create mode 100644 infrastructure/dogfood/terraform/gcp/storage.tf diff --git a/docs/Configuration/fleet-server-configuration.md b/docs/Configuration/fleet-server-configuration.md index f6749863c2..d18c1823e9 100644 --- a/docs/Configuration/fleet-server-configuration.md +++ b/docs/Configuration/fleet-server-configuration.md @@ -2247,7 +2247,7 @@ The IAM identity used in this context must be allowed to perform the following a AWS secret access key to use for S3 authentication. - Default value: none -- Environment variable: `FLEET_S3_SECRET_ACCESS_KEY` +- Environment variable: `FLEET_S3_SOFTWARE_INSTALLERS_SECRET_ACCESS_KEY` - Config file format: ```yaml s3: diff --git a/infrastructure/dogfood/terraform/gcp/.terraform.lock.hcl b/infrastructure/dogfood/terraform/gcp/.terraform.lock.hcl new file mode 100644 index 0000000000..afe278409c --- /dev/null +++ b/infrastructure/dogfood/terraform/gcp/.terraform.lock.hcl @@ -0,0 +1,82 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/google" { + version = "4.51.0" + constraints = ">= 2.12.0, >= 3.45.0, >= 3.53.0, >= 3.60.0, >= 4.51.0, 4.51.0, < 5.0.0, < 6.0.0" + hashes = [ + "h1:7JFdiV9bvV6R+AeWzvNbVeoega481sJY3PqtIbrwTsM=", + "zh:001bf7478e495d497ffd4054453c97ab4dd3e6a24d46496d51d4c8094e95b2b1", + "zh:19db72113552dd295854a99840e85678d421312708e8329a35787fff1baeed8b", + "zh:42c3e629ace225a2cb6cf87b8fabeaf1c56ac8eca6a77b9e3fc489f3cc0a9db5", + "zh:50b930755c4b1f8a01c430d8f688ea79de0b0198c87511baa3a783e360d7e624", + "zh:5acd67f0aafff5ad59e179543cccd1ffd48d69b98af0228506403b8d8193b340", + "zh:70128d57b4b4bf07df941172e6af15c4eda8396af5cc2b0128c906983c7b7fad", + "zh:7905fac0ba2becf0e97edfcd4224e57466b04f960f36a3ec654a0a3c2ffececb", + "zh:79b4cc760305cd77c1ff841f789184f808b8052e8f4faa5cb8d518e4c13beb22", + "zh:c7aebd7d7dd2b29de28e382500d36fae8b4d8a192cf05e41ea29c66f1251acfc", + "zh:d8b4494b13ef5af65d3afedf05bf7565918f1e31ad68ae0df81f5c3b12baf519", + "zh:e6e68ef6881bc3312db50c9fd761f226f34d7834b64f90d96616b7ca6b1daf34", + "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", + ] +} + +provider "registry.terraform.io/hashicorp/google-beta" { + version = "4.85.0" + constraints = ">= 3.45.0, >= 3.53.0, >= 3.62.0, < 5.0.0, < 6.0.0" + hashes = [ + "h1:YkCDGkP0AUZoNobLoxRnM52Pi4alYE9EFXalEu8p8E8=", + "zh:40e9c7ec46955b4d79065a14185043a4ad6af8d0246715853fc5c99208b66980", + "zh:5950a9ba2f96420ea5335b543e315b1a47a705f9a9abfc53c6fec52d084eddcb", + "zh:5dfa98d32246a5d97e018f2b91b0e921cc6f061bc8591884f3b144f0d62f1c20", + "zh:628d0ca35c6d4c35077859bb0a5534c1de44f23a91e190f9c3f06f2358172e75", + "zh:6e78d54fd4de4151968149b4c3521f563a8b5c55aad423dba5968a9114b65ae4", + "zh:91c3bc443188638353285bd35b06d3a3b39b42b3b4cc0637599a430438fba2f7", + "zh:9e91b03363ebf39eea5ec0fbe7675f6979883aa9ad9a36664357d8513a007cf3", + "zh:db9a8d6bfe075fb38c260986ab557d40e8d18e5698c62956a6da8120fae01d59", + "zh:e41169c49f3bb53217905509e2ba8bb4680c373e1f54db7fac1b7f72943a1004", + "zh:f32f55a8af605afbc940814e17493ac83d9d66cd6da9bbc247e0a833a0aa37ec", + "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", + "zh:f6561a6badc3af842f9ad5bb926104954047f07cb90fadcca1357441cc67d91d", + ] +} + +provider "registry.terraform.io/hashicorp/null" { + version = "3.1.1" + constraints = "~> 3.1.0" + hashes = [ + "h1:71sNUDvmiJcijsvfXpiLCz0lXIBSsEJjMxljt7hxMhw=", + "zh:063466f41f1d9fd0dd93722840c1314f046d8760b1812fa67c34de0afcba5597", + "zh:08c058e367de6debdad35fc24d97131c7cf75103baec8279aba3506a08b53faf", + "zh:73ce6dff935150d6ddc6ac4a10071e02647d10175c173cfe5dca81f3d13d8afe", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:8fdd792a626413502e68c195f2097352bdc6a0df694f7df350ed784741eb587e", + "zh:976bbaf268cb497400fd5b3c774d218f3933271864345f18deebe4dcbfcd6afa", + "zh:b21b78ca581f98f4cdb7a366b03ae9db23a73dfa7df12c533d7c19b68e9e72e5", + "zh:b7fc0c1615dbdb1d6fd4abb9c7dc7da286631f7ca2299fb9cd4664258ccfbff4", + "zh:d1efc942b2c44345e0c29bc976594cb7278c38cfb8897b344669eafbc3cddf46", + "zh:e356c245b3cd9d4789bab010893566acace682d7db877e52d40fc4ca34a50924", + "zh:ea98802ba92fcfa8cf12cbce2e9e7ebe999afbf8ed47fa45fc847a098d89468b", + "zh:eff8872458806499889f6927b5d954560f3d74bf20b6043409edf94d26cd906f", + ] +} + +provider "registry.terraform.io/hashicorp/random" { + version = "3.1.3" + constraints = "~> 3.1.0" + hashes = [ + "h1:nLWniS8xhb32qRQy+n4bDPjQ7YWZPVMR3v1vSrx7QyY=", + "zh:26e07aa32e403303fc212a4367b4d67188ac965c37a9812e07acee1470687a73", + "zh:27386f48e9c9d849fbb5a8828d461fde35e71f6b6c9fc235bc4ae8403eb9c92d", + "zh:5f4edda4c94240297bbd9b83618fd362348cadf6bf24ea65ea0e1844d7ccedc0", + "zh:646313a907126cd5e69f6a9fafe816e9154fccdc04541e06fed02bb3a8fa2d2e", + "zh:7349692932a5d462f8dee1500ab60401594dddb94e9aa6bf6c4c0bd53e91bbb8", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:9034daba8d9b32b35930d168f363af04cecb153d5849a7e4a5966c97c5dc956e", + "zh:bb81dfca59ef5f949ef39f19ea4f4de25479907abc28cdaa36d12ecd7c0a9699", + "zh:bcf7806b99b4c248439ae02c8e21f77aff9fadbc019ce619b929eef09d1221bb", + "zh:d708e14d169e61f326535dd08eecd3811cd4942555a6f8efabc37dbff9c6fc61", + "zh:dc294e19a46e1cefb9e557a7b789c8dd8f319beca99b8c265181bc633dc434cc", + "zh:f9d758ee53c55dc016dd736427b6b0c3c8eb4d0dbbc785b6a3579b0ffedd9e42", + ] +} diff --git a/infrastructure/dogfood/terraform/gcp/artifact_registry.tf b/infrastructure/dogfood/terraform/gcp/artifact_registry.tf deleted file mode 100644 index 7e87e4c4dd..0000000000 --- a/infrastructure/dogfood/terraform/gcp/artifact_registry.tf +++ /dev/null @@ -1,7 +0,0 @@ -resource "google_artifact_registry_repository" "my-repo" { - provider = google-beta - location = var.region - repository_id = "${var.prefix}-repository" - description = "repository to hold fleet container images for cloud run" - format = "DOCKER" -} \ No newline at end of file diff --git a/infrastructure/dogfood/terraform/gcp/cloud_run.tf b/infrastructure/dogfood/terraform/gcp/cloud_run.tf index cdda0abbb2..61fc941729 100644 --- a/infrastructure/dogfood/terraform/gcp/cloud_run.tf +++ b/infrastructure/dogfood/terraform/gcp/cloud_run.tf @@ -28,6 +28,10 @@ resource "random_pet" "suffix" { length = 1 } +resource "random_password" "private_key" { + length = 32 +} + resource "google_secret_manager_secret" "secret" { secret_id = "fleet-db-password-${random_pet.suffix.id}" replication { @@ -35,6 +39,18 @@ resource "google_secret_manager_secret" "secret" { } } +resource "google_secret_manager_secret" "private_key" { + secret_id = "fleet-private-key-${random_pet.suffix.id}" + replication { + automatic = true + } +} + +resource "google_secret_manager_secret_version" "private_key" { + secret = google_secret_manager_secret.private_key.name + secret_data = random_password.private_key.result +} + resource "google_secret_manager_secret_version" "secret-version-data" { secret = google_secret_manager_secret.secret.name secret_data = module.fleet-mysql.generated_user_password @@ -49,6 +65,13 @@ resource "google_secret_manager_secret_iam_member" "secret-access" { depends_on = [google_secret_manager_secret.secret] } +resource "google_secret_manager_secret_iam_member" "private-key-access" { + secret_id = google_secret_manager_secret.private_key.id + role = "roles/secretmanager.secretAccessor" + member = "serviceAccount:${data.google_compute_default_service_account.default.email}" + depends_on = [google_secret_manager_secret.private_key] +} + resource "google_cloud_run_service" "default" { name = "${var.prefix}-backend" location = var.region @@ -69,7 +92,7 @@ resource "google_cloud_run_service" "default" { memory = var.fleet_memory } } - image = "${var.region}-docker.pkg.dev/${var.project_id}/${google_artifact_registry_repository.my-repo.name}/${var.image}" + image = var.image ports { name = "http1" container_port = 8080 @@ -82,6 +105,43 @@ resource "google_cloud_run_service" "default" { name = "FLEET_MYSQL_DATABASE" value = var.db_name } + env { + name = "FLEET_S3_SOFTWARE_INSTALLERS_BUCKET" + value = google_storage_bucket.software_installers.id + } + env { + name = "FLEET_S3_SOFTWARE_INSTALLERS_ACCESS_KEY_ID" + value = google_storage_hmac_key.key.access_id + } + env { + name = "FLEET_S3_SOFTWARE_INSTALLERS_SECRET_ACCESS_KEY" + value = google_storage_hmac_key.key.secret + } + env { + name = "FLEET_S3_SOFTWARE_INSTALLERS_ENDPOINT_URL" + value = "https://storage.googleapis.com" + } + env { + // software_installers_force_s3_path_style + name = "FLEET_S3_SOFTWARE_INSTALLERS_FORCE_S3_PATH_STYLE" + value = "true" + } + env { + name = "FLEET_S3_SOFTWARE_INSTALLERS_REGION" + value = "auto" + } + env { + name = "FLEET_LOGGING_JSON" + value = "true" + } + env { + name = "FLEET_LOGGING_DEBUG" + value = var.debug_logging + } + env { + name = "FLEET_LICENSE_KEY" + value = var.license_key + } env { name = "FLEET_SERVER_TLS" value = false @@ -103,6 +163,15 @@ resource "google_cloud_run_service" "default" { } } } + env { + name = "FLEET_SERVER_PRIVATE_KEY" + value_from { + secret_key_ref { + name = google_secret_manager_secret.private_key.secret_id + key = "latest" + } + } + } command = ["/bin/sh"] args = [ "-c", diff --git a/infrastructure/dogfood/terraform/gcp/main.tf b/infrastructure/dogfood/terraform/gcp/main.tf index 9788263789..858579d3ae 100644 --- a/infrastructure/dogfood/terraform/gcp/main.tf +++ b/infrastructure/dogfood/terraform/gcp/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = "4.9.0" + version = "4.51.0" } google-beta = { source = "hashicorp/google-beta" diff --git a/infrastructure/dogfood/terraform/gcp/readme.md b/infrastructure/dogfood/terraform/gcp/readme.md index b4872b1812..65a9f08a57 100644 --- a/infrastructure/dogfood/terraform/gcp/readme.md +++ b/infrastructure/dogfood/terraform/gcp/readme.md @@ -21,31 +21,6 @@ using [Serverless VPC Access Connector](https://cloud.google.com/sql/docs/mysql/ We are running Redis using [Google Cloud Memorystore (Redis engine)](https://cloud.google.com/memorystore). This can run in cluster mode, but by default we are running in standalone mode. -### Pushing the Fleet image into Google Artifact registry - -More details can be found [here](https://cloud.google.com/artifact-registry/docs/docker/pushing-and-pulling). - -Login with gcloud helper: - -```shell -gcloud auth configure-docker \ - us-central1-docker.pkg.dev -``` - -Pull latest image: - -`docker pull ` for example `docker pull fleetdm/fleet:v4.10.0` - -Tag it: - -``` -docker tag fleetdm/fleet:v10.0.0 us-central1-docker.pkg.dev//fleet-repository/fleet:v10.0.0 -``` - -Push to Google Artifact registry: - -`docker push us-central1-docker.pkg.dev//fleet-repository/fleet:v4.9.1` - ### GCP Managed Certificates In this example we are using [GCP Managed Certificates](https://cloud.google.com/load-balancing/docs/ssl-certificates/google-managed-certs) to handle TLS and TLS termination at the LoadBalancer. diff --git a/infrastructure/dogfood/terraform/gcp/storage.tf b/infrastructure/dogfood/terraform/gcp/storage.tf new file mode 100644 index 0000000000..251cc0193c --- /dev/null +++ b/infrastructure/dogfood/terraform/gcp/storage.tf @@ -0,0 +1,23 @@ +data "google_client_config" "current" {} + +resource "google_service_account" "service_account" { + account_id = "fleet-svc" +} + +resource "google_storage_hmac_key" "key" { + service_account_email = google_service_account.service_account.email +} + +resource "google_storage_bucket" "software_installers" { + name = var.software_installers_bucket_name + location = data.google_client_config.current.region + force_destroy = true + + uniform_bucket_level_access = true +} + +resource "google_storage_bucket_iam_member" "hmac_sa_storage_admin" { + bucket = google_storage_bucket.software_installers.name + role = "roles/storage.objectAdmin" + member = "serviceAccount:${google_service_account.service_account.email}" +} \ No newline at end of file diff --git a/infrastructure/dogfood/terraform/gcp/variables.tf b/infrastructure/dogfood/terraform/gcp/variables.tf index 925d977c0d..c4e196bf01 100644 --- a/infrastructure/dogfood/terraform/gcp/variables.tf +++ b/infrastructure/dogfood/terraform/gcp/variables.tf @@ -68,5 +68,18 @@ variable "redis_mem" { } variable "image" { - default = "fleet:v4.54.0" + default = "fleetdm/fleet:v4.54.0" +} + +variable "software_installers_bucket_name" { + default = "fleet-software-installers" +} + +variable "license_key" { + default = "" + description = "Fleet license key" +} + +variable "debug_logging" { + default = "false" } diff --git a/infrastructure/dogfood/terraform/gcp/vpc.tf b/infrastructure/dogfood/terraform/gcp/vpc.tf index 527d44e008..a8b5fa6713 100644 --- a/infrastructure/dogfood/terraform/gcp/vpc.tf +++ b/infrastructure/dogfood/terraform/gcp/vpc.tf @@ -43,3 +43,16 @@ module "private-service-access" { vpc_network = module.vpc.network_name depends_on = [module.vpc] } + +module "cloud_router" { + source = "terraform-google-modules/cloud-router/google" + version = "~> 6.0" + name = "fleet-cloud-router" + project = var.project_id + network = module.vpc.network_name + region = var.region + + nats = [{ + name = "fleet-vpc-nat" + }] +} From 13aafaf46a0bea8cc886b5080efe5af1ee5d07c3 Mon Sep 17 00:00:00 2001 From: Joanne Stableford <59930035+JoStableford@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:45:59 -0400 Subject: [PATCH 2/7] Update receive-from-github.js (#20625) --- website/api/controllers/webhooks/receive-from-github.js | 1 - 1 file changed, 1 deletion(-) diff --git a/website/api/controllers/webhooks/receive-from-github.js b/website/api/controllers/webhooks/receive-from-github.js index afef12eaff..20a5dde537 100644 --- a/website/api/controllers/webhooks/receive-from-github.js +++ b/website/api/controllers/webhooks/receive-from-github.js @@ -78,7 +78,6 @@ module.exports = { 'sampfluger88', 'ireedy', 'mostlikelee', - 'willmayhone88', 'pacamaster', 'AnthonySnyder8', 'jahzielv', From 5a45411e59f4c6d3b718fe3ebde9c83579d7f4d8 Mon Sep 17 00:00:00 2001 From: Noah Talerman <47070608+noahtalerman@users.noreply.github.com> Date: Mon, 22 Jul 2024 09:41:16 -0700 Subject: [PATCH 3/7] Permissions changes for #19055 (#20624) Global observer/+ can no longer run saved scripts. --------- Co-authored-by: Rachael Shaw --- docs/Using Fleet/manage-access.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/Using Fleet/manage-access.md b/docs/Using Fleet/manage-access.md index 5f9457988f..b472b33539 100644 --- a/docs/Using Fleet/manage-access.md +++ b/docs/Using Fleet/manage-access.md @@ -92,10 +92,9 @@ GitOps is an API-only and write-only role that can be used on CI/CD pipelines. | View all [MDM settings](https://fleetdm.com/docs/using-fleet/mdm-macos-settings) | | | | ✅ | ✅ | | Edit setup experience (end user authentication, bootstrap package, Setup Assistant)\* | | | ✅ | ✅ | ✅ | | Edit end user license agreement (EULA)\* | | | | ✅ | | -| Run arbitrary scripts on hosts | | | ✅ | ✅ | | -| View saved scripts | ✅ | ✅ | ✅ | ✅ | | -| Edit/upload saved scripts | | | ✅ | ✅ | ✅ | -| Run saved scripts on hosts | ✅ | ✅ | ✅ | ✅ | | +| Run scripts on hosts | | | ✅ | ✅ | | +| View saved scripts\* | ✅ | ✅ | ✅ | ✅ | | +| Edit/upload saved scripts\* | | | ✅ | ✅ | ✅ | | Lock, unlock, and wipe hosts\* | | | ✅ | ✅ | | \* Applies only to Fleet Premium @@ -165,10 +164,9 @@ Users with access to multiple teams can be assigned different roles for each tea | View metadata of MDM macOS bootstrap packages | | | ✅ | ✅ | | | Edit/upload MDM macOS bootstrap packages | | | ✅ | ✅ | ✅ | | Enable/disable MDM macOS setup end user authentication | | | ✅ | ✅ | ✅ | -| Run arbitrary scripts on hosts | | | ✅ | ✅ | | +| Run scripts on hosts | | | ✅ | ✅ | | | View saved scripts | ✅ | ✅ | ✅ | ✅ | | | Edit/upload saved scripts | | | ✅ | ✅ | | -| Run saved scripts on hosts | ✅ | ✅ | ✅ | ✅ | | | View script details by host | ✅ | ✅ | ✅ | ✅ | | | Lock, unlock, and wipe hosts | | | ✅ | ✅ | | From 2282c495c2d54641647d53823bb7a570a4f036a5 Mon Sep 17 00:00:00 2001 From: jacobshandling <61553566+jacobshandling@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:04:29 -0700 Subject: [PATCH 4/7] Correctly handle `NULL` timezones (#20605) ## Addresses #20618 - Update `CalendarEvent.TimeZone` type to be `*string` - Consider any Fleet calendar event with `NULL` timezone to need an update, and write the latest google calendar timezone - [x] Changes file added for user-visible changes in `changes/`, - [x] Added/updated tests - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling --- changes/20618-nil-tz-not-handled | 2 ++ ee/server/calendar/google_calendar.go | 12 +++++++----- ee/server/calendar/google_calendar_test.go | 6 +++--- server/cron/calendar_cron_test.go | 6 +++--- server/datastore/mysql/calendar_events.go | 7 ++++--- server/datastore/mysql/calendar_events_test.go | 17 +++++++++-------- server/datastore/mysql/hosts_test.go | 4 ++-- server/datastore/mysql/policies_test.go | 8 ++++---- server/fleet/calendar_events.go | 2 +- server/fleet/datastore.go | 4 ++-- server/mock/datastore_mock.go | 8 ++++---- server/service/integration_core_test.go | 7 +++---- 12 files changed, 44 insertions(+), 39 deletions(-) create mode 100644 changes/20618-nil-tz-not-handled diff --git a/changes/20618-nil-tz-not-handled b/changes/20618-nil-tz-not-handled new file mode 100644 index 0000000000..cbb5d0bd99 --- /dev/null +++ b/changes/20618-nil-tz-not-handled @@ -0,0 +1,2 @@ +* Fix a bug where Fleet google calendar events generated by Fleet <= 4.53.0 were not correctly + processed by 4.54.0 \ No newline at end of file diff --git a/ee/server/calendar/google_calendar.go b/ee/server/calendar/google_calendar.go index d43c773eb2..d0d6477d28 100644 --- a/ee/server/calendar/google_calendar.go +++ b/ee/server/calendar/google_calendar.go @@ -280,7 +280,9 @@ func (c *GoogleCalendar) GetAndUpdateEvent(event *fleet.CalendarEvent, genBodyFn if err != nil { return nil, false, err } - tzUpdated := c.location.String() != event.TimeZone + latestTzName := c.location.String() + // nil if cal event created before Fleet tracked timezone + tzUpdated := event.TimeZone == nil || (latestTzName != *event.TimeZone) gEvent, err := c.config.API.GetEvent(details.ID, details.ETag) @@ -291,7 +293,7 @@ func (c *GoogleCalendar) GetAndUpdateEvent(event *fleet.CalendarEvent, genBodyFn if tzUpdated { // this condition occurs when the event itself hasn't been updated, but the calendar timezone // has been, so update the Fleet event's timezone - event.TimeZone = c.location.String() + event.TimeZone = &latestTzName return event, true, nil } return event, false, nil @@ -307,7 +309,7 @@ func (c *GoogleCalendar) GetAndUpdateEvent(event *fleet.CalendarEvent, genBodyFn if tzUpdated { // this condition occurs when the event itself hasn't been updated, but the calendar timezone // has been, so just update the event's timezone - event.TimeZone = c.location.String() + event.TimeZone = &latestTzName return event, true, nil } return event, false, nil @@ -642,12 +644,12 @@ func (c *GoogleCalendar) googleEventToFleetEvent(startTime time.Time, endTime ti resourceID string) ( *fleet.CalendarEvent, error, ) { - + tzName := c.location.String() fleetEvent := &fleet.CalendarEvent{} fleetEvent.StartTime = startTime fleetEvent.EndTime = endTime fleetEvent.Email = c.currentUserEmail - fleetEvent.TimeZone = c.location.String() + fleetEvent.TimeZone = &tzName fleetEvent.UUID = eventUUID details := &eventDetails{ ID: event.Id, diff --git a/ee/server/calendar/google_calendar_test.go b/ee/server/calendar/google_calendar_test.go index 5cd96bfb67..2aaaefa1b5 100644 --- a/ee/server/calendar/google_calendar_test.go +++ b/ee/server/calendar/google_calendar_test.go @@ -203,7 +203,7 @@ func TestGoogleCalendar_GetAndUpdateEvent(t *testing.T) { const baseETag = "event-eTag" const baseEventID = "event-id" const baseResourceID = "resource-id" - const baseTzName = "America/New_York" + baseTzName := "America/New_York" baseTzLocation, _ := time.LoadLocation(baseTzName) mockAPI.GetEventFunc = func(id, eTag string) (*calendar.Event, error) { assert.Equal(t, baseEventID, id) @@ -228,7 +228,7 @@ func TestGoogleCalendar_GetAndUpdateEvent(t *testing.T) { StartTime: eventStartTime, EndTime: time.Now().Add(time.Hour).In(baseTzLocation), Data: []byte(`{"ID":"` + baseEventID + `","ETag":"` + baseETag + `"}`), - TimeZone: baseTzName, + TimeZone: &baseTzName, } // ETag matches @@ -525,7 +525,7 @@ func TestGoogleCalendar_CreateEvent(t *testing.T) { assert.Equal(t, baseEventID, details.ID) assert.Equal(t, channelUUID, details.ChannelID) assert.Equal(t, baseResourceID, details.ResourceID) - assert.Equal(t, tzId, event.TimeZone) + assert.Equal(t, tzId, *event.TimeZone) // Workday already ended date = time.Now().Add(-48 * time.Hour) diff --git a/server/cron/calendar_cron_test.go b/server/cron/calendar_cron_test.go index 0111f72291..b4cb9141b9 100644 --- a/server/cron/calendar_cron_test.go +++ b/server/cron/calendar_cron_test.go @@ -343,7 +343,7 @@ func TestCalendarEventsMultipleHosts(t *testing.T) { email string, startTime, endTime time.Time, data []byte, - timeZone string, + timeZone *string, hostID uint, webhookStatus fleet.CalendarWebhookStatus, ) (*fleet.CalendarEvent, error) { @@ -633,7 +633,7 @@ func TestCalendarEvents1KHosts(t *testing.T) { email string, startTime, endTime time.Time, data []byte, - timeZone string, + timeZone *string, hostID uint, webhookStatus fleet.CalendarWebhookStatus, ) (*fleet.CalendarEvent, error) { @@ -923,7 +923,7 @@ func TestEventBody(t *testing.T) { email string, startTime, endTime time.Time, data []byte, - timeZone string, + timeZone *string, hostID uint, webhookStatus fleet.CalendarWebhookStatus, ) (*fleet.CalendarEvent, error) { diff --git a/server/datastore/mysql/calendar_events.go b/server/datastore/mysql/calendar_events.go index 433e15a16a..af8200b2b0 100644 --- a/server/datastore/mysql/calendar_events.go +++ b/server/datastore/mysql/calendar_events.go @@ -5,9 +5,10 @@ import ( "database/sql" "errors" "fmt" - "github.com/google/uuid" "time" + "github.com/google/uuid" + "github.com/fleetdm/fleet/v4/server/contexts/ctxerr" "github.com/fleetdm/fleet/v4/server/fleet" "github.com/jmoiron/sqlx" @@ -22,7 +23,7 @@ func (ds *Datastore) CreateOrUpdateCalendarEvent( startTime time.Time, endTime time.Time, data []byte, - timeZone string, + timeZone *string, hostID uint, webhookStatus fleet.CalendarWebhookStatus, ) (*fleet.CalendarEvent, error) { @@ -153,7 +154,7 @@ func (ds *Datastore) GetCalendarEventDetailsByUUID(ctx context.Context, uuidStr } func (ds *Datastore) UpdateCalendarEvent(ctx context.Context, calendarEventID uint, uuidStr string, startTime time.Time, endTime time.Time, - data []byte, timeZone string) error { + data []byte, timeZone *string) error { UUID, err := uuid.Parse(uuidStr) if err != nil { return ctxerr.Wrap(ctx, err, "invalid uuid") diff --git a/server/datastore/mysql/calendar_events_test.go b/server/datastore/mysql/calendar_events_test.go index bee3ef6ed9..3003692a98 100644 --- a/server/datastore/mysql/calendar_events_test.go +++ b/server/datastore/mysql/calendar_events_test.go @@ -2,12 +2,13 @@ package mysql import ( "context" - "github.com/google/uuid" - "github.com/stretchr/testify/assert" "strings" "testing" "time" + "github.com/google/uuid" + "github.com/stretchr/testify/assert" + "github.com/fleetdm/fleet/v4/server/fleet" "github.com/fleetdm/fleet/v4/server/ptr" "github.com/stretchr/testify/require" @@ -60,14 +61,14 @@ func testUpdateCalendarEvent(t *testing.T, ds *Datastore) { endTime1 := startTime1.Add(30 * time.Minute) timeZone := "America/Argentina/Buenos_Aires" eventUUID := uuid.New().String() - calendarEvent, err := ds.CreateOrUpdateCalendarEvent(ctx, eventUUID, "foo@example.com", startTime1, endTime1, []byte(`{}`), timeZone, + calendarEvent, err := ds.CreateOrUpdateCalendarEvent(ctx, eventUUID, "foo@example.com", startTime1, endTime1, []byte(`{}`), &timeZone, host.ID, fleet.CalendarWebhookStatusNone) require.NoError(t, err) time.Sleep(1 * time.Second) eventUUIDNew := uuid.New().String() - err = ds.UpdateCalendarEvent(ctx, calendarEvent.ID, eventUUIDNew, startTime1, endTime1, []byte(`{}`), timeZone) + err = ds.UpdateCalendarEvent(ctx, calendarEvent.ID, eventUUIDNew, startTime1, endTime1, []byte(`{}`), &timeZone) require.NoError(t, err) calendarEvent2, err := ds.GetCalendarEvent(ctx, "foo@example.com") @@ -117,15 +118,15 @@ func testCreateOrUpdateCalendarEvent(t *testing.T, ds *Datastore) { startTime1 := time.Now() endTime1 := startTime1.Add(30 * time.Minute) eventUUID := uuid.New().String() - calendarEvent, err := ds.CreateOrUpdateCalendarEvent(ctx, eventUUID, "foo@example.com", startTime1, endTime1, []byte(`{}`), timeZone, + calendarEvent, err := ds.CreateOrUpdateCalendarEvent(ctx, eventUUID, "foo@example.com", startTime1, endTime1, []byte(`{}`), &timeZone, host.ID, fleet.CalendarWebhookStatusNone) require.NoError(t, err) - require.Equal(t, calendarEvent.TimeZone, timeZone) + require.Equal(t, *calendarEvent.TimeZone, timeZone) time.Sleep(1 * time.Second) eventUUID2 := uuid.New().String() - calendarEvent2, err := ds.CreateOrUpdateCalendarEvent(ctx, eventUUID2, "foo@example.com", startTime1, endTime1, []byte(`{}`), timeZone, + calendarEvent2, err := ds.CreateOrUpdateCalendarEvent(ctx, eventUUID2, "foo@example.com", startTime1, endTime1, []byte(`{}`), &timeZone, host.ID, fleet.CalendarWebhookStatusNone) require.NoError(t, err) require.Greater(t, calendarEvent2.UpdatedAt, calendarEvent.UpdatedAt) @@ -139,7 +140,7 @@ func testCreateOrUpdateCalendarEvent(t *testing.T, ds *Datastore) { startTime2 := startTime1.Add(1 * time.Hour) endTime2 := startTime1.Add(30 * time.Minute) calendarEvent3, err := ds.CreateOrUpdateCalendarEvent(ctx, eventUUID2, "foo@example.com", startTime2, endTime2, - []byte(`{"foo": "bar"}`), timeZone, host.ID, fleet.CalendarWebhookStatusPending) + []byte(`{"foo": "bar"}`), &timeZone, host.ID, fleet.CalendarWebhookStatusPending) require.NoError(t, err) require.Greater(t, calendarEvent3.UpdatedAt, calendarEvent2.UpdatedAt) require.WithinDuration(t, startTime2, calendarEvent3.StartTime, 1*time.Second) diff --git a/server/datastore/mysql/hosts_test.go b/server/datastore/mysql/hosts_test.go index 9e36aba767..5d5bcf7746 100644 --- a/server/datastore/mysql/hosts_test.go +++ b/server/datastore/mysql/hosts_test.go @@ -9617,9 +9617,9 @@ func testListUpcomingHostMaintenanceWindows(t *testing.T, ds *Datastore) { startTime := time.Now().UTC().Add(30 * time.Minute) endTime := startTime.Add(30 * time.Minute) calendarEvent, err := ds.CreateOrUpdateCalendarEvent(ctx, uuid.New().String(), "foo@example.com", startTime, endTime, []byte(`{}`), - timeZone, host.ID, fleet.CalendarWebhookStatusNone) + &timeZone, host.ID, fleet.CalendarWebhookStatusNone) require.NoError(t, err) - require.Equal(t, calendarEvent.TimeZone, timeZone) + require.Equal(t, *calendarEvent.TimeZone, timeZone) mWs, err = ds.ListUpcomingHostMaintenanceWindows(ctx, host.ID) require.NoError(t, err) diff --git a/server/datastore/mysql/policies_test.go b/server/datastore/mysql/policies_test.go index fdf9012509..d3b9bdb93a 100644 --- a/server/datastore/mysql/policies_test.go +++ b/server/datastore/mysql/policies_test.go @@ -3651,11 +3651,11 @@ func testGetTeamHostsPolicyMemberships(t *testing.T, ds *Datastore) { tZ := "America/Argentina/Buenos_Aires" now := time.Now() eventUUID1 := uuid.New().String() - _, err = ds.CreateOrUpdateCalendarEvent(ctx, eventUUID1, "foo@example.com", now, now.Add(30*time.Minute), []byte(`{"foo": "bar"}`), tZ, + _, err = ds.CreateOrUpdateCalendarEvent(ctx, eventUUID1, "foo@example.com", now, now.Add(30*time.Minute), []byte(`{"foo": "bar"}`), &tZ, host1.ID, fleet.CalendarWebhookStatusPending) require.NoError(t, err) eventUUID2 := uuid.New().String() - _, err = ds.CreateOrUpdateCalendarEvent(ctx, eventUUID2, "bar@example.com", now, now.Add(30*time.Minute), []byte(`{"foo": "bar"}`), tZ, + _, err = ds.CreateOrUpdateCalendarEvent(ctx, eventUUID2, "bar@example.com", now, now.Add(30*time.Minute), []byte(`{"foo": "bar"}`), &tZ, host6.ID, fleet.CalendarWebhookStatusPending) require.NoError(t, err) @@ -3737,12 +3737,12 @@ func testGetTeamHostsPolicyMemberships(t *testing.T, ds *Datastore) { // Create a calendar event on host2 and host3. // now = time.Now() - _, err = ds.CreateOrUpdateCalendarEvent(ctx, eventUUID1, "foo@example.com", now, now.Add(30*time.Minute), []byte(`{"foo": "bar"}`), tZ, + _, err = ds.CreateOrUpdateCalendarEvent(ctx, eventUUID1, "foo@example.com", now, now.Add(30*time.Minute), []byte(`{"foo": "bar"}`), &tZ, host2.ID, fleet.CalendarWebhookStatusPending) require.NoError(t, err) eventUUID3 := uuid.New().String() calendarEventHost3, err := ds.CreateOrUpdateCalendarEvent(ctx, eventUUID3, "zoo@example.com", now, now.Add(30*time.Minute), - []byte(`{"foo": "bar"}`), tZ, host3.ID, fleet.CalendarWebhookStatusPending) + []byte(`{"foo": "bar"}`), &tZ, host3.ID, fleet.CalendarWebhookStatusPending) require.NoError(t, err) // diff --git a/server/fleet/calendar_events.go b/server/fleet/calendar_events.go index 96d5a9a93f..f624993b38 100644 --- a/server/fleet/calendar_events.go +++ b/server/fleet/calendar_events.go @@ -9,7 +9,7 @@ type CalendarEvent struct { StartTime time.Time `db:"start_time"` EndTime time.Time `db:"end_time"` Data []byte `db:"event"` - TimeZone string `db:"timezone"` + TimeZone *string `db:"timezone"` // Only nil when event existed before addition of timezone column UpdateCreateTimestamps } diff --git a/server/fleet/datastore.go b/server/fleet/datastore.go index cd9c904f3a..927adaba2b 100644 --- a/server/fleet/datastore.go +++ b/server/fleet/datastore.go @@ -692,12 +692,12 @@ type Datastore interface { // Calendar events CreateOrUpdateCalendarEvent(ctx context.Context, uuid string, email string, startTime time.Time, endTime time.Time, data []byte, - timeZone string, hostID uint, webhookStatus CalendarWebhookStatus) (*CalendarEvent, error) + timeZone *string, hostID uint, webhookStatus CalendarWebhookStatus) (*CalendarEvent, error) GetCalendarEvent(ctx context.Context, email string) (*CalendarEvent, error) GetCalendarEventDetailsByUUID(ctx context.Context, uuid string) (*CalendarEventDetails, error) DeleteCalendarEvent(ctx context.Context, calendarEventID uint) error UpdateCalendarEvent(ctx context.Context, calendarEventID uint, uuid string, startTime time.Time, endTime time.Time, data []byte, - timeZone string) error + timeZone *string) error GetHostCalendarEvent(ctx context.Context, hostID uint) (*HostCalendarEvent, *CalendarEvent, error) GetHostCalendarEventByEmail(ctx context.Context, email string) (*HostCalendarEvent, *CalendarEvent, error) UpdateHostCalendarWebhookStatus(ctx context.Context, hostID uint, status CalendarWebhookStatus) error diff --git a/server/mock/datastore_mock.go b/server/mock/datastore_mock.go index a8fc105d92..3529137156 100644 --- a/server/mock/datastore_mock.go +++ b/server/mock/datastore_mock.go @@ -503,7 +503,7 @@ type DeleteSoftwareVulnerabilitiesFunc func(ctx context.Context, vulnerabilities type DeleteOutOfDateVulnerabilitiesFunc func(ctx context.Context, source fleet.VulnerabilitySource, duration time.Duration) error -type CreateOrUpdateCalendarEventFunc func(ctx context.Context, uuid string, email string, startTime time.Time, endTime time.Time, data []byte, timeZone string, hostID uint, webhookStatus fleet.CalendarWebhookStatus) (*fleet.CalendarEvent, error) +type CreateOrUpdateCalendarEventFunc func(ctx context.Context, uuid string, email string, startTime time.Time, endTime time.Time, data []byte, timeZone *string, hostID uint, webhookStatus fleet.CalendarWebhookStatus) (*fleet.CalendarEvent, error) type GetCalendarEventFunc func(ctx context.Context, email string) (*fleet.CalendarEvent, error) @@ -511,7 +511,7 @@ type GetCalendarEventDetailsByUUIDFunc func(ctx context.Context, uuid string) (* type DeleteCalendarEventFunc func(ctx context.Context, calendarEventID uint) error -type UpdateCalendarEventFunc func(ctx context.Context, calendarEventID uint, uuid string, startTime time.Time, endTime time.Time, data []byte, timeZone string) error +type UpdateCalendarEventFunc func(ctx context.Context, calendarEventID uint, uuid string, startTime time.Time, endTime time.Time, data []byte, timeZone *string) error type GetHostCalendarEventFunc func(ctx context.Context, hostID uint) (*fleet.HostCalendarEvent, *fleet.CalendarEvent, error) @@ -4137,7 +4137,7 @@ func (s *DataStore) DeleteOutOfDateVulnerabilities(ctx context.Context, source f return s.DeleteOutOfDateVulnerabilitiesFunc(ctx, source, duration) } -func (s *DataStore) CreateOrUpdateCalendarEvent(ctx context.Context, uuid string, email string, startTime time.Time, endTime time.Time, data []byte, timeZone string, hostID uint, webhookStatus fleet.CalendarWebhookStatus) (*fleet.CalendarEvent, error) { +func (s *DataStore) CreateOrUpdateCalendarEvent(ctx context.Context, uuid string, email string, startTime time.Time, endTime time.Time, data []byte, timeZone *string, hostID uint, webhookStatus fleet.CalendarWebhookStatus) (*fleet.CalendarEvent, error) { s.mu.Lock() s.CreateOrUpdateCalendarEventFuncInvoked = true s.mu.Unlock() @@ -4165,7 +4165,7 @@ func (s *DataStore) DeleteCalendarEvent(ctx context.Context, calendarEventID uin return s.DeleteCalendarEventFunc(ctx, calendarEventID) } -func (s *DataStore) UpdateCalendarEvent(ctx context.Context, calendarEventID uint, uuid string, startTime time.Time, endTime time.Time, data []byte, timeZone string) error { +func (s *DataStore) UpdateCalendarEvent(ctx context.Context, calendarEventID uint, uuid string, startTime time.Time, endTime time.Time, data []byte, timeZone *string) error { s.mu.Lock() s.UpdateCalendarEventFuncInvoked = true s.mu.Unlock() diff --git a/server/service/integration_core_test.go b/server/service/integration_core_test.go index 3c9c9dfcca..d37423f2f5 100644 --- a/server/service/integration_core_test.go +++ b/server/service/integration_core_test.go @@ -8334,9 +8334,8 @@ func (s *integrationTestSuite) TestGetHostMaintenanceWindow() { StartTime: startTime, EndTime: endTime, Data: []byte(`{}`), - // will replace with NULL - db method doesn't allow nil - TimeZone: "", - UUID: uuid.New().String(), + TimeZone: nil, + UUID: uuid.New().String(), } dsEvent, err := s.ds.CreateOrUpdateCalendarEvent(ctx, testEvent.UUID, testEvent.Email, testEvent.StartTime, testEvent.EndTime, @@ -8371,7 +8370,7 @@ func (s *integrationTestSuite) TestGetHostMaintenanceWindow() { // update the timezone _, err = s.ds.CreateOrUpdateCalendarEvent(ctx, testEvent.UUID, testEvent.Email, testEvent.StartTime, testEvent.EndTime, testEvent.Data, - timeZone, host.ID, fleet.CalendarWebhookStatusNone) + &timeZone, host.ID, fleet.CalendarWebhookStatusNone) require.NoError(t, err) time.Sleep(1 * time.Second) From 1a512b27920375e34fe10240b3bec9d3da01e3de Mon Sep 17 00:00:00 2001 From: Lucas Manuel Rodriguez Date: Mon, 22 Jul 2024 14:26:03 -0300 Subject: [PATCH 5/7] Do not set `last_enrolled_at` when re-enrolling orbit (#20620) Server fix for #20397. (I incorrectly added that `last_enrolled_at = NOW()` on the first iOS/iPadOS support PR.) - [X] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [x] Added/updated tests. - [ ] Manual QA for all new/changed functionality. --- .../20397-do-not-set-last_enrolled_at-when-enrolling-orbit | 1 + server/datastore/mysql/hosts.go | 1 - server/datastore/mysql/hosts_test.go | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changes/20397-do-not-set-last_enrolled_at-when-enrolling-orbit diff --git a/changes/20397-do-not-set-last_enrolled_at-when-enrolling-orbit b/changes/20397-do-not-set-last_enrolled_at-when-enrolling-orbit new file mode 100644 index 0000000000..c8f305c4d1 --- /dev/null +++ b/changes/20397-do-not-set-last_enrolled_at-when-enrolling-orbit @@ -0,0 +1 @@ +* Fixed a bug that set `last_enrolled_at` during orbit re-enrollment, which caused osquery enroll failures when `FLEET_OSQUERY_ENROLL_COOLDOWN` is set . diff --git a/server/datastore/mysql/hosts.go b/server/datastore/mysql/hosts.go index 8c671787a4..a37dd0ac8b 100644 --- a/server/datastore/mysql/hosts.go +++ b/server/datastore/mysql/hosts.go @@ -1874,7 +1874,6 @@ func (ds *Datastore) EnrollOrbit(ctx context.Context, isMDMEnabled bool, hostInf uuid = COALESCE(NULLIF(uuid, ''), ?), osquery_host_id = COALESCE(NULLIF(osquery_host_id, ''), ?), hardware_serial = COALESCE(NULLIF(hardware_serial, ''), ?), - last_enrolled_at = NOW(), team_id = ? WHERE id = ?` _, err := tx.ExecContext(ctx, sqlUpdate, diff --git a/server/datastore/mysql/hosts_test.go b/server/datastore/mysql/hosts_test.go index 5d5bcf7746..fb37661ccf 100644 --- a/server/datastore/mysql/hosts_test.go +++ b/server/datastore/mysql/hosts_test.go @@ -8258,7 +8258,9 @@ func testHostsEnrollOrbit(t *testing.T, ds *Datastore) { require.NoError(t, err) h2OrbitFetched, err := ds.Host(ctx, h2Orbit.ID) require.NoError(t, err) - require.NotEqual(t, h1OsqueryFetched.LastEnrolledAt, h2OrbitFetched.LastEnrolledAt) + // orbit should not update last_enrolled_at if re-enrolling (because last_enrolled_at + // is to be set by osquery only). + require.Equal(t, h1OsqueryFetched.LastEnrolledAt, h2OrbitFetched.LastEnrolledAt) time.Sleep(1 * time.Second) // to test the update of last_enrolled_at h2Osquery, err := ds.EnrollHost(ctx, false, dupUUID, dupUUID, dupHWSerial, uuid.New().String(), nil, 0) require.NoError(t, err) From 5e1a3d03ae270a3f1fc1730ba73b453303ed12d6 Mon Sep 17 00:00:00 2001 From: Dante Catalfamo <43040593+dantecatalfamo@users.noreply.github.com> Date: Mon, 22 Jul 2024 16:27:36 -0400 Subject: [PATCH 6/7] MySQL 8.0 Migration (#20225) #17249 --- .github/workflows/fleet-and-orbit.yml | 2 +- .github/workflows/test-go.yaml | 2 +- articles/deploy-fleet-on-hetzner-cloud.md | 18 +- changes/17249-mysql-8 | 2 + docker-compose.yml | 6 +- .../fleet-server-configuration.md | 2 +- docs/Contributing/File-carving.md | 3 +- docs/Deploy/Reference-Architectures.md | 4 +- docs/Get started/FAQ.md | 6 +- server/datastore/mysql/schema.sql | 1255 +++++++++-------- server/service/handler_test.go | 2 +- server/service/hosts.go | 4 +- test/upgrade/docker-compose.yaml | 2 +- tools/backup_db/backup.sh | 2 +- tools/backup_db/restore.sh | 2 +- tools/backup_db/restore_e2e_software_test.sh | 3 +- .../mysql-replica-testing/docker-compose.yml | 4 +- tools/osquery/in-a-box/docker-compose.yml | 2 +- tools/percona/test/upgrade.sh | 4 +- 19 files changed, 679 insertions(+), 646 deletions(-) create mode 100644 changes/17249-mysql-8 diff --git a/.github/workflows/fleet-and-orbit.yml b/.github/workflows/fleet-and-orbit.yml index b4ada881ec..4cab7da482 100644 --- a/.github/workflows/fleet-and-orbit.yml +++ b/.github/workflows/fleet-and-orbit.yml @@ -63,7 +63,7 @@ jobs: strategy: matrix: go-version: ["${{ vars.GO_VERSION }}"] - mysql: ["mysql:5.7"] + mysql: ["mysql:8.0.36"] runs-on: ubuntu-latest needs: gen steps: diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 05706da9a4..0f128b8025 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -45,7 +45,7 @@ jobs: suite: ["integration", "core"] os: [ubuntu-latest] go-version: ['${{ vars.GO_VERSION }}'] - mysql: ["mysql:5.7.21", "mysql:8.0.28"] + mysql: ["mysql:8.0.36"] continue-on-error: ${{ matrix.suite == 'integration' }} # Since integration tests have a higher chance of failing, often for unrelated reasons, we don't want to fail the whole job if they fail runs-on: ${{ matrix.os }} diff --git a/articles/deploy-fleet-on-hetzner-cloud.md b/articles/deploy-fleet-on-hetzner-cloud.md index 82dac9495c..a7cd76f1c4 100644 --- a/articles/deploy-fleet-on-hetzner-cloud.md +++ b/articles/deploy-fleet-on-hetzner-cloud.md @@ -69,14 +69,14 @@ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docke apt update apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin -docker pull mysql@sha256:16e159331007eccc069822f7b731272043ed572a79a196a05ffa2ea127caaf67 # mysql:5.7.38 as of 2022/05/19 +docker pull mysql@sha256:134e2d1c7c517d05e5328a77aa5a165a314dc4c4116503e7e089494f4e398ab1 # mysql:8.0.36 as of 2024/07/04 ###################### # MySQL (dockerized) # ###################### -# mysql:5.7.38 as of 2022/05/19 -docker pull mysql@sha256:16e159331007eccc069822f7b731272043ed572a79a196a05ffa2ea127caaf67 +# mysql:8.0.36 as of 2024/07/04 +docker pull mysql@sha256:134e2d1c7c517d05e5328a77aa5a165a314dc4c4116503e7e089494f4e398ab1 # Create the Fleet MySQL data folder mkdir -p /etc/fleet @@ -102,14 +102,14 @@ Restart=always ExecStartPre=-/usr/bin/docker exec %n stop ExecStartPre=-/usr/bin/docker rm %n -ExecStartPre=-/usr/bin/docker pull mysql@sha256:16e159331007eccc069822f7b731272043ed572a79a196a05ffa2ea127caaf67 +ExecStartPre=-/usr/bin/docker pull mysql@sha256:134e2d1c7c517d05e5328a77aa5a165a314dc4c4116503e7e089494f4e398ab1 ExecStart=/usr/bin/docker run --rm \ --name %n \ -p 127.0.0.1:3306:3306 \ -v /etc/fleet/mysql:/var/lib/mysql \ --env-file /etc/fleet/mysql.env \ - mysql@sha256:16e159331007eccc069822f7b731272043ed572a79a196a05ffa2ea127caaf67 + mysql@sha256:134e2d1c7c517d05e5328a77aa5a165a314dc4c4116503e7e089494f4e398ab1 ExecStop=/usr/bin/docker stop %n @@ -435,7 +435,7 @@ To run MySQL, we’ll have to do the following: We can pull the [official MySQL docker image](https://hub.docker.com/_/mysql) like so: ```sh -$ docker pull mysql@sha256:16e159331007eccc069822f7b731272043ed572a79a196a05ffa2ea127caaf67 # mysql:5.7.38 as of 2022/05/19 +$ docker pull mysql@sha256:134e2d1c7c517d05e5328a77aa5a165a314dc4c4116503e7e089494f4e398ab1 # mysql:8.0.36 as of 2024/07/04 ``` ### Create & enable a systemd unit for MySQL @@ -472,14 +472,14 @@ Restart=always ExecStartPre=-/usr/bin/docker exec %n stop ExecStartPre=-/usr/bin/docker rm %n -ExecStartPre=-/usr/bin/docker pull mysql@sha256:16e159331007eccc069822f7b731272043ed572a79a196a05ffa2ea127caaf67 +ExecStartPre=-/usr/bin/docker pull mysql@sha256:134e2d1c7c517d05e5328a77aa5a165a314dc4c4116503e7e089494f4e398ab1 ExecStart=/usr/bin/docker run --rm \ --name %n \ -p 127.0.0.1:3306:3306 \ -v /etc/fleet/mysql:/var/lib/mysql \ --env-file /etc/fleet/mysql.env \ - mysql@sha256:16e159331007eccc069822f7b731272043ed572a79a196a05ffa2ea127caaf67 + mysql@sha256:134e2d1c7c517d05e5328a77aa5a165a314dc4c4116503e7e089494f4e398ab1 ExecStop=/usr/bin/docker stop %n @@ -712,4 +712,4 @@ Now that you’re ready to use Fleet and have a host installed. Here's some next - \ No newline at end of file + diff --git a/changes/17249-mysql-8 b/changes/17249-mysql-8 new file mode 100644 index 0000000000..b3948968cf --- /dev/null +++ b/changes/17249-mysql-8 @@ -0,0 +1,2 @@ +* Drop support for MySQL 5.7 +* Minimum requirements raised to MySQL 8.0 diff --git a/docker-compose.yml b/docker-compose.yml index 5b8b7b48ec..437e5ddc71 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: # officially supported). # To run in macOS M1, set FLEET_MYSQL_IMAGE=arm64v8/mysql:oracle FLEET_MYSQL_PLATFORM=linux/arm64/v8 mysql: - image: ${FLEET_MYSQL_IMAGE:-mysql:5.7.21} + image: ${FLEET_MYSQL_IMAGE:-mysql:8.0.36} platform: ${FLEET_MYSQL_PLATFORM:-linux/x86_64} volumes: - mysql-persistent-volume:/tmp @@ -30,7 +30,7 @@ services: - "3306:3306" mysql_test: - image: ${FLEET_MYSQL_IMAGE:-mysql:5.7.21} + image: ${FLEET_MYSQL_IMAGE:-mysql:8.0.36} platform: ${FLEET_MYSQL_PLATFORM:-linux/x86_64} # innodb-file-per-table=OFF gives ~20% speedup for test runs. command: [ @@ -56,7 +56,7 @@ services: - /tmpfs mysql_replica_test: - image: ${FLEET_MYSQL_IMAGE:-mysql:5.7.21} + image: ${FLEET_MYSQL_IMAGE:-mysql:8.0.36} platform: ${FLEET_MYSQL_PLATFORM:-linux/x86_64} # innodb-file-per-table=OFF gives ~20% speedup for test runs. command: [ diff --git a/docs/Configuration/fleet-server-configuration.md b/docs/Configuration/fleet-server-configuration.md index d18c1823e9..76e25658d6 100644 --- a/docs/Configuration/fleet-server-configuration.md +++ b/docs/Configuration/fleet-server-configuration.md @@ -236,7 +236,7 @@ The maximum amount of time, in seconds, a connection may be reused. ##### mysql_sql_mode -Sets the connection `sql_mode`. See [MySQL Reference](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html) for more details. +Sets the connection `sql_mode`. See [MySQL Reference](https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html) for more details. This setting should not usually be used. - Default value: `""` diff --git a/docs/Contributing/File-carving.md b/docs/Contributing/File-carving.md index 57b743f207..4daad97fb0 100644 --- a/docs/Contributing/File-carving.md +++ b/docs/Contributing/File-carving.md @@ -23,8 +23,7 @@ The default flagfile provided in the "Add new host" dialog also includes this co The `carver_block_size` flag should be configured in osquery. For the (default) MySQL Backend, the configured value must be less than the value of -`max_allowed_packet` in the MySQL connection, allowing for some overhead. The default for [MySQL 5.7](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_allowed_packet) -is 4MB and for [MySQL 8](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet) it is 64MB. +`max_allowed_packet` in the MySQL connection, allowing for some overhead. The default for [MySQL 8](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet) it is 64MB. For the S3/Minio backend, this value must be set to at least 5MiB (`5242880`) due to the [constraints of S3's multipart diff --git a/docs/Deploy/Reference-Architectures.md b/docs/Deploy/Reference-Architectures.md index 5241ea3b27..06a7d8dd5a 100644 --- a/docs/Deploy/Reference-Architectures.md +++ b/docs/Deploy/Reference-Architectures.md @@ -26,7 +26,7 @@ Fleet currently has three infrastructure dependencies: MySQL, Redis, and a TLS c Fleet uses MySQL extensively as its main database. Many cloud providers (such as [AWS](https://aws.amazon.com/rds/mysql/) and [GCP](https://cloud.google.com/sql/)) host reliable MySQL services which you may consider for this purpose. A well-supported MySQL [Docker image](https://hub.docker.com/_/mysql/) also exists if you would rather run MySQL in a container. For more information on how to configure the `fleet` binary to use the correct MySQL instance, see the [Configuration](https://fleetdm.com/docs/deploying/configuration) document. -Fleet requires at least MySQL version 5.7, and is tested using the InnoDB storage engine. +Fleet requires at least MySQL version 8.0, and is tested using the InnoDB storage engine. There are many "drop-in replacements" for MySQL available. If you'd like to experiment with some bleeding-edge technology and use Fleet with one of these alternative database servers, we think that's awesome! Please be aware they are not officially supported and that it is very important to set up a dev environment to thoroughly test new releases. @@ -277,7 +277,7 @@ The following permissions are the minimum required to apply AWS terraform resour GCP reference architecture can be found in [the Fleet repository](https://github.com/fleetdm/fleet/tree/main/infrastructure/dogfood/terraform/gcp). This configuration includes: - Cloud Run (Fleet backend) -- Cloud SQL MySQL 5.7 (Fleet database) +- Cloud SQL MySQL 8.0 (Fleet database) - Memorystore Redis (Fleet cache & live query orchestrator) GCP support for add/install software and file carve features is coming soon. Get [commmunity support](https://chat.osquery.io/c/fleet). diff --git a/docs/Get started/FAQ.md b/docs/Get started/FAQ.md index 36fc34a434..d341739ad9 100644 --- a/docs/Get started/FAQ.md +++ b/docs/Get started/FAQ.md @@ -594,7 +594,7 @@ This could be caused by a mismatched connection limit between the Fleet server a ### Why am I receiving a database connection error when attempting to "prepare" the database? -First, check if you have a version of MySQL installed that is at least 5.7. Then, make sure that you currently have a MySQL server running. +First, check if you have a version of MySQL installed that is at least 8.0. Then, make sure that you currently have a MySQL server running. The next step is to make sure the credentials for the database match what is expected. Test your ability to connect to the database with `mysql -u -h -P -D -p`. @@ -614,7 +614,7 @@ Yes! Please sign up for the [Fleet Cloud Beta](https://kqphpqst851.typeform.com/ ### What MySQL versions are supported? -Fleet is tested with MySQL 5.7.21 and 8.0.28. Newer versions of MySQL 5.7 and MySQL 8 typically work well. AWS Aurora requires at least version 2.10.0. Please avoid using MariaDB or other MySQL variants that are not officially supported. Compatibility issues have been identified with MySQL variants, and these may not be addressed in future Fleet releases. +Fleet is tested with MySQL 8.0.36. Newer versions of MySQL 8 typically work well. AWS Aurora requires at least version 2.10.0. Please avoid using MariaDB or other MySQL variants that are not officially supported. Compatibility issues have been identified with MySQL variants, and these may not be addressed in future Fleet releases. ### What are the MySQL user requirements? @@ -677,7 +677,7 @@ If you would like to use Fleet's MDM features, the following endpoints need to b ### What is the minimum version of MySQL required by Fleet? -Fleet requires at least MySQL version 5.7. +Fleet requires at least MySQL version 8.0. ### How do I migrate from Fleet Free to Fleet Premium? diff --git a/server/datastore/mysql/schema.sql b/server/datastore/mysql/schema.sql index 41dc6c8f84..46a7ea3192 100644 --- a/server/datastore/mysql/schema.sql +++ b/server/datastore/mysql/schema.sql @@ -1,9 +1,9 @@ /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `activities` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `created_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `user_id` int(10) unsigned DEFAULT NULL, + `user_id` int unsigned DEFAULT NULL, `user_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `activity_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `details` json DEFAULT NULL, @@ -14,89 +14,89 @@ CREATE TABLE `activities` ( KEY `activities_streamed_idx` (`streamed`), KEY `activities_created_at_idx` (`created_at`), CONSTRAINT `activities_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `aggregated_stats` ( - `id` bigint(20) unsigned NOT NULL, + `id` bigint unsigned NOT NULL, `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `json_value` json NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `global_stats` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`,`type`,`global_stats`), KEY `idx_aggregated_stats_updated_at` (`updated_at`), KEY `aggregated_stats_type_idx` (`type`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `app_config_json` ( - `id` int(10) unsigned NOT NULL DEFAULT '1', + `id` int unsigned NOT NULL DEFAULT '1', `json_value` json NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `app_config_json` VALUES (1,'{\"mdm\": {\"macos_setup\": {\"bootstrap_package\": null, \"macos_setup_assistant\": null, \"enable_end_user_authentication\": false, \"enable_release_device_manually\": false}, \"macos_updates\": {\"deadline\": null, \"minimum_version\": null}, \"macos_settings\": {\"custom_settings\": null}, \"macos_migration\": {\"mode\": \"\", \"enable\": false, \"webhook_url\": \"\"}, \"windows_updates\": {\"deadline_days\": null, \"grace_period_days\": null}, \"windows_settings\": {\"custom_settings\": null}, \"apple_bm_default_team\": \"\", \"apple_bm_terms_expired\": false, \"enable_disk_encryption\": false, \"enabled_and_configured\": false, \"end_user_authentication\": {\"idp_name\": \"\", \"metadata\": \"\", \"entity_id\": \"\", \"issuer_uri\": \"\", \"metadata_url\": \"\"}, \"windows_enabled_and_configured\": false, \"apple_bm_enabled_and_configured\": false}, \"scripts\": null, \"features\": {\"enable_host_users\": true, \"enable_software_inventory\": false}, \"org_info\": {\"org_name\": \"\", \"contact_url\": \"\", \"org_logo_url\": \"\", \"org_logo_url_light_background\": \"\"}, \"integrations\": {\"jira\": null, \"zendesk\": null, \"google_calendar\": null}, \"sso_settings\": {\"idp_name\": \"\", \"metadata\": \"\", \"entity_id\": \"\", \"enable_sso\": false, \"issuer_uri\": \"\", \"metadata_url\": \"\", \"idp_image_url\": \"\", \"enable_jit_role_sync\": false, \"enable_sso_idp_login\": false, \"enable_jit_provisioning\": false}, \"agent_options\": {\"config\": {\"options\": {\"logger_plugin\": \"tls\", \"pack_delimiter\": \"/\", \"logger_tls_period\": 10, \"distributed_plugin\": \"tls\", \"disable_distributed\": false, \"logger_tls_endpoint\": \"/api/osquery/log\", \"distributed_interval\": 10, \"distributed_tls_max_attempts\": 3}, \"decorators\": {\"load\": [\"SELECT uuid AS host_uuid FROM system_info;\", \"SELECT hostname AS hostname FROM system_info;\"]}}, \"overrides\": {}}, \"fleet_desktop\": {\"transparency_url\": \"\"}, \"smtp_settings\": {\"port\": 587, \"domain\": \"\", \"server\": \"\", \"password\": \"\", \"user_name\": \"\", \"configured\": false, \"enable_smtp\": false, \"enable_ssl_tls\": true, \"sender_address\": \"\", \"enable_start_tls\": true, \"verify_ssl_certs\": true, \"authentication_type\": \"0\", \"authentication_method\": \"0\"}, \"server_settings\": {\"server_url\": \"\", \"enable_analytics\": false, \"query_report_cap\": 0, \"scripts_disabled\": false, \"deferred_save_host\": false, \"live_query_disabled\": false, \"ai_features_disabled\": false, \"query_reports_disabled\": false}, \"webhook_settings\": {\"interval\": \"0s\", \"activities_webhook\": {\"destination_url\": \"\", \"enable_activities_webhook\": false}, \"host_status_webhook\": {\"days_count\": 0, \"destination_url\": \"\", \"host_percentage\": 0, \"enable_host_status_webhook\": false}, \"vulnerabilities_webhook\": {\"destination_url\": \"\", \"host_batch_size\": 0, \"enable_vulnerabilities_webhook\": false}, \"failing_policies_webhook\": {\"policy_ids\": null, \"destination_url\": \"\", \"host_batch_size\": 0, \"enable_failing_policies_webhook\": false}}, \"host_expiry_settings\": {\"host_expiry_window\": 0, \"host_expiry_enabled\": false}, \"vulnerability_settings\": {\"databases_path\": \"\"}, \"activity_expiry_settings\": {\"activity_expiry_window\": 0, \"activity_expiry_enabled\": false}}','2020-01-01 01:01:01','2020-01-01 01:01:01'); /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `calendar_events` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `end_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `event` json NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `timezone` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `timezone` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `uuid_bin` binary(16) NOT NULL, - `uuid` varchar(36) COLLATE utf8mb4_unicode_ci GENERATED ALWAYS AS (insert(insert(insert(insert(hex(`uuid_bin`),9,0,'-'),14,0,'-'),19,0,'-'),24,0,'-')) VIRTUAL, + `uuid` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci GENERATED ALWAYS AS (insert(insert(insert(insert(hex(`uuid_bin`),9,0,_utf8mb4'-'),14,0,_utf8mb4'-'),19,0,_utf8mb4'-'),24,0,_utf8mb4'-')) VIRTUAL, PRIMARY KEY (`id`), UNIQUE KEY `idx_one_calendar_event_per_email` (`email`), UNIQUE KEY `idx_calendar_events_uuid_bin_unique` (`uuid_bin`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `carve_blocks` ( - `metadata_id` int(10) unsigned NOT NULL, - `block_id` int(11) NOT NULL, + `metadata_id` int unsigned NOT NULL, + `block_id` int NOT NULL, `data` longblob, PRIMARY KEY (`metadata_id`,`block_id`), CONSTRAINT `carve_blocks_ibfk_1` FOREIGN KEY (`metadata_id`) REFERENCES `carve_metadata` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `carve_metadata` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `host_id` int(10) unsigned NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `host_id` int unsigned NOT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `block_count` int(10) unsigned NOT NULL, - `block_size` int(10) unsigned NOT NULL, - `carve_size` bigint(20) unsigned NOT NULL, + `block_count` int unsigned NOT NULL, + `block_size` int unsigned NOT NULL, + `carve_size` bigint unsigned NOT NULL, `carve_id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `request_id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `session_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `expired` tinyint(4) DEFAULT '0', - `max_block` int(11) DEFAULT '-1', + `expired` tinyint DEFAULT '0', + `max_block` int DEFAULT '-1', `error` text COLLATE utf8mb4_unicode_ci, PRIMARY KEY (`id`), UNIQUE KEY `idx_session_id` (`session_id`), UNIQUE KEY `idx_name` (`name`), KEY `host_id` (`host_id`), CONSTRAINT `carve_metadata_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `cron_stats` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `instance` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `stats_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, @@ -105,70 +105,70 @@ CREATE TABLE `cron_stats` ( `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `idx_cron_stats_name_created_at` (`name`,`created_at`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `cve_meta` ( `cve` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL, `cvss_score` double DEFAULT NULL, `epss_probability` double DEFAULT NULL, `cisa_known_exploit` tinyint(1) DEFAULT NULL, `published` timestamp NULL DEFAULT NULL, - `description` text COLLATE utf8mb4_unicode_ci, + `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, PRIMARY KEY (`cve`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `distributed_query_campaign_targets` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `type` int(11) DEFAULT NULL, - `distributed_query_campaign_id` int(10) unsigned DEFAULT NULL, - `target_id` int(10) unsigned DEFAULT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `type` int DEFAULT NULL, + `distributed_query_campaign_id` int unsigned DEFAULT NULL, + `target_id` int unsigned DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `distributed_query_campaigns` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `query_id` int(10) unsigned DEFAULT NULL, - `status` int(11) DEFAULT NULL, - `user_id` int(10) unsigned DEFAULT NULL, + `query_id` int unsigned DEFAULT NULL, + `status` int DEFAULT NULL, + `user_id` int unsigned DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `email_changes` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `user_id` int(10) unsigned NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `user_id` int unsigned NOT NULL, `token` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL, `new_email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_unique_email_changes_token` (`token`) USING BTREE, KEY `fk_email_changes_users` (`user_id`), CONSTRAINT `fk_email_changes_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `enroll_secrets` ( `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, - `team_id` int(10) unsigned DEFAULT NULL, + `team_id` int unsigned DEFAULT NULL, PRIMARY KEY (`secret`), KEY `fk_enroll_secrets_team_id` (`team_id`), CONSTRAINT `enroll_secrets_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `eulas` ( - `id` int(10) unsigned NOT NULL, + `id` int unsigned NOT NULL, `token` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `bytes` longblob, @@ -177,44 +177,44 @@ CREATE TABLE `eulas` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_activities` ( - `host_id` int(10) unsigned NOT NULL, - `activity_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, + `activity_id` int unsigned NOT NULL, PRIMARY KEY (`host_id`,`activity_id`), KEY `fk_host_activities_activity_id` (`activity_id`), CONSTRAINT `host_activities_ibfk_1` FOREIGN KEY (`activity_id`) REFERENCES `activities` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_additional` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `additional` json DEFAULT NULL, PRIMARY KEY (`host_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_batteries` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `host_id` int(10) unsigned NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `host_id` int unsigned NOT NULL, `serial_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `cycle_count` int(10) NOT NULL, + `cycle_count` int NOT NULL, `health` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `idx_host_batteries_host_id_serial_number` (`host_id`,`serial_number`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_calendar_events` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `host_id` int(10) unsigned NOT NULL, - `calendar_event_id` int(10) unsigned NOT NULL, - `webhook_status` tinyint(4) NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `host_id` int unsigned NOT NULL, + `calendar_event_id` int unsigned NOT NULL, + `webhook_status` tinyint NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), @@ -224,48 +224,48 @@ CREATE TABLE `host_calendar_events` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_dep_assignments` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `added_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `deleted_at` timestamp NULL DEFAULT NULL, - `profile_uuid` varchar(37) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `assign_profile_response` varchar(15) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `profile_uuid` varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `assign_profile_response` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `response_updated_at` timestamp NULL DEFAULT NULL, - `retry_job_id` int(10) unsigned NOT NULL DEFAULT '0', + `retry_job_id` int unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`host_id`), KEY `idx_hdep_response` (`assign_profile_response`,`response_updated_at`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_device_auth` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`host_id`), UNIQUE KEY `idx_host_device_auth_token` (`token`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_disk_encryption_keys` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `base64_encrypted` text COLLATE utf8mb4_unicode_ci NOT NULL, `decryptable` tinyint(1) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `reset_requested` tinyint(1) NOT NULL DEFAULT '0', - `client_error` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `client_error` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`host_id`), KEY `idx_host_disk_encryption_keys_decryptable` (`decryptable`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_disks` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `gigs_disk_space_available` decimal(10,2) NOT NULL DEFAULT '0.00', `percent_disk_space_available` decimal(10,2) NOT NULL DEFAULT '0.00', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -274,22 +274,22 @@ CREATE TABLE `host_disks` ( `gigs_total_disk_space` decimal(10,2) NOT NULL DEFAULT '0.00', PRIMARY KEY (`host_id`), KEY `idx_host_disks_gigs_disk_space_available` (`gigs_disk_space_available`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_display_names` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `display_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`host_id`), KEY `display_name` (`display_name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_emails` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `host_id` int(10) unsigned NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `host_id` int unsigned NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `source` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -297,15 +297,15 @@ CREATE TABLE `host_emails` ( PRIMARY KEY (`id`), KEY `idx_host_emails_host_id_email` (`host_id`,`email`), KEY `idx_host_emails_email` (`email`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_issues` ( - `host_id` int(10) unsigned NOT NULL, - `failing_policies_count` int(10) unsigned NOT NULL DEFAULT '0', - `critical_vulnerabilities_count` int(10) unsigned NOT NULL DEFAULT '0', - `total_issues_count` int(10) unsigned NOT NULL DEFAULT '0', + `host_id` int unsigned NOT NULL, + `failing_policies_count` int unsigned NOT NULL DEFAULT '0', + `critical_vulnerabilities_count` int unsigned NOT NULL DEFAULT '0', + `total_issues_count` int unsigned NOT NULL DEFAULT '0', `created_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), `updated_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3), PRIMARY KEY (`host_id`), @@ -313,34 +313,34 @@ CREATE TABLE `host_issues` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_mdm` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `enrolled` tinyint(1) NOT NULL DEFAULT '0', `server_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `installed_from_dep` tinyint(1) NOT NULL DEFAULT '0', - `mdm_id` int(10) unsigned DEFAULT NULL, + `mdm_id` int unsigned DEFAULT NULL, `is_server` tinyint(1) DEFAULT NULL, - `fleet_enroll_ref` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `fleet_enroll_ref` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`host_id`), KEY `host_mdm_mdm_id_idx` (`mdm_id`), KEY `host_mdm_enrolled_installed_from_dep_idx` (`enrolled`,`installed_from_dep`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_mdm_actions` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `lock_ref` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `wipe_ref` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `unlock_pin` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `unlock_ref` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `fleet_platform` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `fleet_platform` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`host_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_mdm_apple_bootstrap_packages` ( `host_uuid` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL, `command_uuid` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL, @@ -350,16 +350,16 @@ CREATE TABLE `host_mdm_apple_bootstrap_packages` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_mdm_apple_declarations` ( - `host_uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `operation_type` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `detail` text COLLATE utf8mb4_unicode_ci, + `host_uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `operation_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `detail` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `checksum` binary(16) NOT NULL, - `declaration_uuid` varchar(37) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `declaration_identifier` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `declaration_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `declaration_uuid` varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `declaration_identifier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `declaration_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`host_uuid`,`declaration_uuid`), KEY `status` (`status`), KEY `operation_type` (`operation_type`), @@ -368,7 +368,7 @@ CREATE TABLE `host_mdm_apple_declarations` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_mdm_apple_profiles` ( `profile_identifier` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `host_uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, @@ -378,17 +378,17 @@ CREATE TABLE `host_mdm_apple_profiles` ( `command_uuid` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL, `profile_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `checksum` binary(16) NOT NULL, - `retries` tinyint(3) unsigned NOT NULL DEFAULT '0', - `profile_uuid` varchar(37) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `retries` tinyint unsigned NOT NULL DEFAULT '0', + `profile_uuid` varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`host_uuid`,`profile_uuid`), KEY `status` (`status`), KEY `operation_type` (`operation_type`), CONSTRAINT `host_mdm_apple_profiles_ibfk_1` FOREIGN KEY (`status`) REFERENCES `mdm_delivery_status` (`status`) ON UPDATE CASCADE, CONSTRAINT `host_mdm_apple_profiles_ibfk_2` FOREIGN KEY (`operation_type`) REFERENCES `mdm_operation_types` (`operation_type`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_mdm_windows_profiles` ( `host_uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -396,71 +396,71 @@ CREATE TABLE `host_mdm_windows_profiles` ( `detail` text COLLATE utf8mb4_unicode_ci, `command_uuid` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL, `profile_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `retries` tinyint(3) unsigned NOT NULL DEFAULT '0', - `profile_uuid` varchar(37) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `retries` tinyint unsigned NOT NULL DEFAULT '0', + `profile_uuid` varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`host_uuid`,`profile_uuid`), KEY `status` (`status`), KEY `operation_type` (`operation_type`), CONSTRAINT `host_mdm_windows_profiles_ibfk_1` FOREIGN KEY (`status`) REFERENCES `mdm_delivery_status` (`status`) ON UPDATE CASCADE, CONSTRAINT `host_mdm_windows_profiles_ibfk_2` FOREIGN KEY (`operation_type`) REFERENCES `mdm_operation_types` (`operation_type`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_munki_info` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `version` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`host_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_munki_issues` ( - `host_id` int(10) unsigned NOT NULL, - `munki_issue_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, + `munki_issue_id` int unsigned NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`host_id`,`munki_issue_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_operating_system` ( - `host_id` int(10) unsigned NOT NULL, - `os_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, + `os_id` int unsigned NOT NULL, PRIMARY KEY (`host_id`), KEY `idx_host_operating_system_id` (`os_id`), CONSTRAINT `host_operating_system_ibfk_1` FOREIGN KEY (`os_id`) REFERENCES `operating_systems` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_orbit_info` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `version` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, `desktop_version` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `scripts_enabled` tinyint(1) DEFAULT NULL, PRIMARY KEY (`host_id`), KEY `idx_host_orbit_info_version` (`version`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_script_results` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `host_id` int(10) unsigned NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `host_id` int unsigned NOT NULL, `execution_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `output` text COLLATE utf8mb4_unicode_ci NOT NULL, - `runtime` int(10) unsigned NOT NULL DEFAULT '0', - `exit_code` int(10) DEFAULT NULL, + `runtime` int unsigned NOT NULL DEFAULT '0', + `exit_code` int DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `script_id` int(10) unsigned DEFAULT NULL, - `user_id` int(10) unsigned DEFAULT NULL, + `script_id` int unsigned DEFAULT NULL, + `user_id` int unsigned DEFAULT NULL, `sync_request` tinyint(1) NOT NULL DEFAULT '0', - `script_content_id` int(10) unsigned DEFAULT NULL, + `script_content_id` int unsigned DEFAULT NULL, `host_deleted_at` timestamp NULL DEFAULT NULL, - `timeout` int(11) DEFAULT NULL, + `timeout` int DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_host_script_results_execution_id` (`execution_id`), KEY `idx_host_script_results_host_exit_created` (`host_id`,`exit_code`,`created_at`), @@ -471,51 +471,51 @@ CREATE TABLE `host_script_results` ( CONSTRAINT `fk_host_script_results_script_id` FOREIGN KEY (`script_id`) REFERENCES `scripts` (`id`) ON DELETE SET NULL, CONSTRAINT `fk_host_script_results_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL, CONSTRAINT `host_script_results_ibfk_1` FOREIGN KEY (`script_content_id`) REFERENCES `script_contents` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_seen_times` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `seen_time` timestamp NULL DEFAULT NULL, PRIMARY KEY (`host_id`), KEY `idx_host_seen_times_seen_time` (`seen_time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_software` ( - `host_id` int(10) unsigned NOT NULL, - `software_id` bigint(20) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, + `software_id` bigint unsigned NOT NULL, `last_opened_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`host_id`,`software_id`), KEY `host_software_software_fk` (`software_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_software_installed_paths` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `host_id` int(10) unsigned NOT NULL, - `software_id` bigint(20) unsigned NOT NULL, + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `host_id` int unsigned NOT NULL, + `software_id` bigint unsigned NOT NULL, `installed_path` text COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), KEY `host_id_software_id_idx` (`host_id`,`software_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_software_installs` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `execution_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `host_id` int(10) unsigned NOT NULL, - `software_installer_id` int(10) unsigned NOT NULL, - `pre_install_query_output` text COLLATE utf8mb4_unicode_ci, - `install_script_output` text COLLATE utf8mb4_unicode_ci, - `install_script_exit_code` int(10) DEFAULT NULL, - `post_install_script_output` text COLLATE utf8mb4_unicode_ci, - `post_install_script_exit_code` int(10) DEFAULT NULL, - `user_id` int(10) unsigned DEFAULT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `execution_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `host_id` int unsigned NOT NULL, + `software_installer_id` int unsigned NOT NULL, + `pre_install_query_output` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `install_script_output` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `install_script_exit_code` int DEFAULT NULL, + `post_install_script_output` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `post_install_script_exit_code` int DEFAULT NULL, + `user_id` int unsigned DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `self_service` tinyint(1) NOT NULL DEFAULT '0', @@ -526,72 +526,72 @@ CREATE TABLE `host_software_installs` ( KEY `idx_host_software_installs_host_installer` (`host_id`,`software_installer_id`), CONSTRAINT `fk_host_software_installs_installer_id` FOREIGN KEY (`software_installer_id`) REFERENCES `software_installers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_host_software_installs_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_updates` ( - `host_id` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `software_updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`host_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `host_users` ( - `host_id` int(10) unsigned NOT NULL, - `uid` int(10) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, + `uid` int unsigned NOT NULL, `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `groupname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `removed_at` timestamp NULL DEFAULT NULL, `user_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `shell` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '', PRIMARY KEY (`host_id`,`uid`,`username`), UNIQUE KEY `idx_uid_username` (`host_id`,`uid`,`username`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `hosts` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `osquery_host_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `osquery_host_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `detail_updated_at` timestamp NULL DEFAULT NULL, `node_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, - `hostname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `platform` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `osquery_version` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `os_version` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `build` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `platform_like` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `code_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `uptime` bigint(20) NOT NULL DEFAULT '0', - `memory` bigint(20) NOT NULL DEFAULT '0', - `cpu_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `cpu_subtype` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `cpu_brand` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `cpu_physical_cores` int(11) NOT NULL DEFAULT '0', - `cpu_logical_cores` int(11) NOT NULL DEFAULT '0', - `hardware_vendor` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `hardware_model` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `hardware_version` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `hardware_serial` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `computer_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `primary_ip_id` int(10) unsigned DEFAULT NULL, - `distributed_interval` int(11) DEFAULT '0', - `logger_tls_period` int(11) DEFAULT '0', - `config_tls_refresh` int(11) DEFAULT '0', - `primary_ip` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `primary_mac` varchar(17) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `platform` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `osquery_version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `os_version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `build` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `platform_like` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `code_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `uptime` bigint NOT NULL DEFAULT '0', + `memory` bigint NOT NULL DEFAULT '0', + `cpu_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `cpu_subtype` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `cpu_brand` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `cpu_physical_cores` int NOT NULL DEFAULT '0', + `cpu_logical_cores` int NOT NULL DEFAULT '0', + `hardware_vendor` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `hardware_model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `hardware_version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `hardware_serial` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `computer_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `primary_ip_id` int unsigned DEFAULT NULL, + `distributed_interval` int DEFAULT '0', + `logger_tls_period` int DEFAULT '0', + `config_tls_refresh` int DEFAULT '0', + `primary_ip` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `primary_mac` varchar(17) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `label_updated_at` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00', `last_enrolled_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `refetch_requested` tinyint(1) NOT NULL DEFAULT '0', - `team_id` int(10) unsigned DEFAULT NULL, + `team_id` int unsigned DEFAULT NULL, `policy_updated_at` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00', - `public_ip` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `public_ip` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `orbit_node_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `refetch_critical_queries_until` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), @@ -604,27 +604,27 @@ CREATE TABLE `hosts` ( FULLTEXT KEY `host_ip_mac_search` (`primary_ip`,`primary_mac`), FULLTEXT KEY `hosts_search` (`hostname`,`uuid`,`computer_name`), CONSTRAINT `hosts_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE SET NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `invite_teams` ( - `invite_id` int(10) unsigned NOT NULL, - `team_id` int(10) unsigned NOT NULL, + `invite_id` int unsigned NOT NULL, + `team_id` int unsigned NOT NULL, `role` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`invite_id`,`team_id`), KEY `fk_team_id` (`team_id`), CONSTRAINT `invite_teams_ibfk_1` FOREIGN KEY (`invite_id`) REFERENCES `invites` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invite_teams_ibfk_2` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `invites` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `invited_by` int(10) unsigned NOT NULL, + `invited_by` int unsigned NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `position` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -634,68 +634,68 @@ CREATE TABLE `invites` ( PRIMARY KEY (`id`), UNIQUE KEY `idx_invite_unique_email` (`email`), UNIQUE KEY `idx_invite_unique_key` (`token`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `jobs` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `args` json DEFAULT NULL, `state` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `retries` int(11) NOT NULL DEFAULT '0', + `retries` int NOT NULL DEFAULT '0', `error` text COLLATE utf8mb4_unicode_ci, `not_before` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `jobs` VALUES (1,'2024-03-20 00:00:00','2024-03-20 00:00:00','macos_setup_assistant','{\"task\": \"update_all_profiles\"}','queued',0,'','2024-03-20 00:00:00'); /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `label_membership` ( - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `label_id` int(10) unsigned NOT NULL, - `host_id` int(10) unsigned NOT NULL, + `label_id` int unsigned NOT NULL, + `host_id` int unsigned NOT NULL, PRIMARY KEY (`host_id`,`label_id`), KEY `idx_lm_label_id` (`label_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `labels` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `query` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `platform` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `label_type` int(10) unsigned NOT NULL DEFAULT '1', - `label_membership_type` int(10) unsigned NOT NULL DEFAULT '0', + `label_type` int unsigned NOT NULL DEFAULT '1', + `label_membership_type` int unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `idx_label_unique_name` (`name`), FULLTEXT KEY `labels_search` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `labels` VALUES (1,'2024-04-03 00:00:00','2024-04-03 00:00:00','macOS 14+ (Sonoma+)','macOS hosts with version 14 and above','select 1 from os_version where platform = \'darwin\' and major >= 14;','darwin',1,0),(2,'2024-06-28 00:00:00','2024-06-28 00:00:00','iOS','All iOS hosts','','ios',1,1),(3,'2024-06-28 00:00:00','2024-06-28 00:00:00','iPadOS','All iPadOS hosts','','ipados',1,1); /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `locks` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `owner` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `expires_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `expires_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `idx_name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_apple_bootstrap_packages` ( - `team_id` int(10) unsigned NOT NULL, + `team_id` int unsigned NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `sha256` binary(32) NOT NULL, `bytes` longblob, @@ -704,31 +704,31 @@ CREATE TABLE `mdm_apple_bootstrap_packages` ( `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`team_id`), UNIQUE KEY `idx_token` (`token`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_apple_configuration_profiles` ( - `profile_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `team_id` int(10) unsigned NOT NULL DEFAULT '0', + `profile_id` int unsigned NOT NULL AUTO_INCREMENT, + `team_id` int unsigned NOT NULL DEFAULT '0', `identifier` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `mobileconfig` mediumblob NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `uploaded_at` timestamp NULL DEFAULT NULL, `checksum` binary(16) NOT NULL, - `profile_uuid` varchar(37) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `profile_uuid` varchar(37) 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`), UNIQUE KEY `idx_mdm_apple_config_prof_id` (`profile_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_apple_declaration_activation_references` ( - `declaration_uuid` varchar(37) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `reference` varchar(37) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `declaration_uuid` varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `reference` varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`declaration_uuid`,`reference`), KEY `reference` (`reference`), CONSTRAINT `mdm_apple_declaration_activation_references_ibfk_1` FOREIGN KEY (`declaration_uuid`) REFERENCES `mdm_apple_declarations` (`declaration_uuid`) ON UPDATE CASCADE, @@ -736,12 +736,12 @@ CREATE TABLE `mdm_apple_declaration_activation_references` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_apple_declarations` ( - `declaration_uuid` varchar(37) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `team_id` int(10) unsigned NOT NULL DEFAULT '0', - `identifier` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `declaration_uuid` varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `team_id` int unsigned NOT NULL DEFAULT '0', + `identifier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `raw_json` json NOT NULL, `checksum` binary(16) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -752,12 +752,12 @@ CREATE TABLE `mdm_apple_declarations` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_apple_declarative_requests` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `enrollment_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `message_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `enrollment_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `message_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `raw_json` text COLLATE utf8mb4_unicode_ci, PRIMARY KEY (`id`), KEY `mdm_apple_declarative_requests_enrollment_id` (`enrollment_id`), @@ -765,13 +765,13 @@ CREATE TABLE `mdm_apple_declarative_requests` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_apple_default_setup_assistants` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `team_id` int(10) unsigned DEFAULT NULL, - `global_or_team_id` int(10) unsigned NOT NULL DEFAULT '0', + `id` int unsigned NOT NULL AUTO_INCREMENT, + `team_id` int unsigned DEFAULT NULL, + `global_or_team_id` int unsigned NOT NULL DEFAULT '0', `profile_uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `idx_mdm_default_setup_assistant_global_or_team_id` (`global_or_team_id`), @@ -780,56 +780,56 @@ CREATE TABLE `mdm_apple_default_setup_assistants` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_apple_enrollment_profiles` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `token` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `type` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'automatic', `dep_profile` json DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `idx_type` (`type`), UNIQUE KEY `idx_token` (`token`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_apple_installers` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `size` bigint(20) NOT NULL, + `size` bigint NOT NULL, `manifest` text COLLATE utf8mb4_unicode_ci NOT NULL, `installer` longblob, `url_token` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_apple_setup_assistants` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `team_id` int(10) unsigned DEFAULT NULL, - `global_or_team_id` int(10) unsigned NOT NULL DEFAULT '0', + `id` int unsigned NOT NULL AUTO_INCREMENT, + `team_id` int unsigned DEFAULT NULL, + `global_or_team_id` int unsigned NOT NULL DEFAULT '0', `name` text COLLATE utf8mb4_unicode_ci NOT NULL, `profile` json NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `profile_uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`id`), UNIQUE KEY `idx_mdm_setup_assistant_global_or_team_id` (`global_or_team_id`), KEY `fk_mdm_setup_assistant_team_id` (`team_id`), CONSTRAINT `mdm_apple_setup_assistants_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_config_assets` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `id` int unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `value` longblob NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, - `deletion_uuid` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `deletion_uuid` varchar(127) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `md5_checksum` binary(16) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), @@ -837,13 +837,13 @@ CREATE TABLE `mdm_config_assets` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_configuration_profile_labels` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `apple_profile_uuid` varchar(37) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `windows_profile_uuid` varchar(37) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `label_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `label_id` int(10) unsigned DEFAULT NULL, + `label_id` int unsigned DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `exclude` tinyint(1) NOT NULL DEFAULT '0', @@ -853,16 +853,17 @@ CREATE TABLE `mdm_configuration_profile_labels` ( KEY `label_id` (`label_id`), CONSTRAINT `mdm_configuration_profile_labels_ibfk_1` FOREIGN KEY (`apple_profile_uuid`) REFERENCES `mdm_apple_configuration_profiles` (`profile_uuid`) ON DELETE CASCADE, CONSTRAINT `mdm_configuration_profile_labels_ibfk_2` FOREIGN KEY (`windows_profile_uuid`) REFERENCES `mdm_windows_configuration_profiles` (`profile_uuid`) ON DELETE CASCADE, - CONSTRAINT `mdm_configuration_profile_labels_ibfk_3` FOREIGN KEY (`label_id`) REFERENCES `labels` (`id`) ON DELETE SET NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + CONSTRAINT `mdm_configuration_profile_labels_ibfk_3` FOREIGN KEY (`label_id`) REFERENCES `labels` (`id`) ON DELETE SET NULL, + CONSTRAINT `ck_mdm_configuration_profile_labels_apple_or_windows` CHECK (((`apple_profile_uuid` is null) <> (`windows_profile_uuid` is null))) +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_declaration_labels` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `apple_declaration_uuid` varchar(37) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `label_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `label_id` int(10) unsigned DEFAULT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `apple_declaration_uuid` varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `label_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `label_id` int unsigned DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `uploaded_at` timestamp NULL DEFAULT NULL, `exclude` tinyint(1) NOT NULL DEFAULT '0', @@ -871,54 +872,54 @@ CREATE TABLE `mdm_declaration_labels` ( KEY `label_id` (`label_id`), CONSTRAINT `mdm_declaration_labels_ibfk_1` FOREIGN KEY (`apple_declaration_uuid`) REFERENCES `mdm_apple_declarations` (`declaration_uuid`) ON DELETE CASCADE, CONSTRAINT `mdm_declaration_labels_ibfk_3` FOREIGN KEY (`label_id`) REFERENCES `labels` (`id`) ON DELETE SET NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_delivery_status` ( `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`status`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `mdm_delivery_status` VALUES ('failed'),('pending'),('verified'),('verifying'); /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_idp_accounts` ( `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `fullname` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`uuid`), UNIQUE KEY `unique_idp_email` (`email`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_operation_types` ( `operation_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`operation_type`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `mdm_operation_types` VALUES ('install'),('remove'); /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_windows_configuration_profiles` ( - `team_id` int(10) unsigned NOT NULL DEFAULT '0', + `team_id` int unsigned NOT NULL DEFAULT '0', `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `syncml` mediumblob NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `uploaded_at` timestamp NULL DEFAULT NULL, - `profile_uuid` varchar(37) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `profile_uuid` varchar(37) 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`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mdm_windows_enrollments` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `mdm_device_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `mdm_hardware_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `device_state` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, @@ -931,93 +932,100 @@ CREATE TABLE `mdm_windows_enrollments` ( `not_in_oobe` tinyint(1) NOT NULL DEFAULT '0', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `host_uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `host_uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`id`), UNIQUE KEY `idx_type` (`mdm_hardware_id`), KEY `idx_mdm_windows_enrollments_mdm_device_id` (`mdm_device_id`), KEY `idx_mdm_windows_enrollments_host_uuid` (`host_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `migration_status_tables` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `version_id` bigint(20) NOT NULL, + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `version_id` bigint NOT NULL, `is_applied` tinyint(1) NOT NULL, `tstamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=284 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=284 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'); /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mobile_device_management_solutions` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `server_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `idx_mobile_device_management_solutions_name` (`name`,`server_url`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `munki_issues` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `issue_type` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `idx_munki_issues_name` (`name`,`issue_type`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `nano_cert_auth_associations` ( `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `sha256` char(64) COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `cert_not_valid_after` timestamp NULL DEFAULT NULL, - `renew_command_uuid` varchar(127) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `renew_command_uuid` varchar(127) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`,`sha256`), KEY `renew_command_uuid_fk` (`renew_command_uuid`), - CONSTRAINT `renew_command_uuid_fk` FOREIGN KEY (`renew_command_uuid`) REFERENCES `nano_commands` (`command_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + CONSTRAINT `renew_command_uuid_fk` FOREIGN KEY (`renew_command_uuid`) REFERENCES `nano_commands` (`command_uuid`), + CONSTRAINT `nano_cert_auth_associations_chk_1` CHECK ((`id` <> _utf8mb4'')), + CONSTRAINT `nano_cert_auth_associations_chk_2` CHECK ((`sha256` <> _utf8mb4'')) +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `nano_command_results` ( `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `command_uuid` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL, `status` varchar(31) COLLATE utf8mb4_unicode_ci NOT NULL, `result` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `not_now_at` timestamp NULL DEFAULT NULL, - `not_now_tally` int(11) NOT NULL DEFAULT '0', - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `not_now_tally` int NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`,`command_uuid`), KEY `command_uuid` (`command_uuid`), KEY `status` (`status`), CONSTRAINT `nano_command_results_ibfk_1` FOREIGN KEY (`id`) REFERENCES `nano_enrollments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `nano_command_results_ibfk_2` FOREIGN KEY (`command_uuid`) REFERENCES `nano_commands` (`command_uuid`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + CONSTRAINT `nano_command_results_ibfk_2` FOREIGN KEY (`command_uuid`) REFERENCES `nano_commands` (`command_uuid`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `nano_command_results_chk_1` CHECK ((`status` <> _utf8mb4'')), + CONSTRAINT `nano_command_results_chk_2` CHECK ((substr(`result`,1,5) = _utf8mb4' _utf8mb4'')), + CONSTRAINT `nano_commands_chk_2` CHECK ((`request_type` <> _utf8mb4'')), + CONSTRAINT `nano_commands_chk_3` CHECK ((substr(`command`,1,5) = _utf8mb4' _utf8mb4''))), + CONSTRAINT `nano_devices_chk_3` CHECK (((`unlock_token` is null) or (length(`unlock_token`) > 0))), + CONSTRAINT `nano_devices_chk_4` CHECK ((`authenticate` <> _utf8mb4'')), + CONSTRAINT `nano_devices_chk_5` CHECK (((`token_update` is null) or (`token_update` <> _utf8mb4''))), + CONSTRAINT `nano_devices_chk_6` CHECK (((`bootstrap_token_b64` is null) or (`bootstrap_token_b64` <> _utf8mb4''))) +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `nano_enrollment_queue` ( `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `command_uuid` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL, `active` tinyint(1) NOT NULL DEFAULT '1', - `priority` tinyint(4) NOT NULL DEFAULT '0', - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `priority` tinyint NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`,`command_uuid`), KEY `command_uuid` (`command_uuid`), - KEY `priority` (`priority`,`created_at`), + KEY `priority` (`priority` DESC,`created_at`), CONSTRAINT `nano_enrollment_queue_ibfk_1` FOREIGN KEY (`id`) REFERENCES `nano_enrollments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `nano_enrollment_queue_ibfk_2` FOREIGN KEY (`command_uuid`) REFERENCES `nano_commands` (`command_uuid`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `nano_enrollments` ( `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `device_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, @@ -1084,33 +1100,41 @@ CREATE TABLE `nano_enrollments` ( `push_magic` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL, `token_hex` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `enabled` tinyint(1) NOT NULL DEFAULT '1', - `token_update_tally` int(11) NOT NULL DEFAULT '1', - `last_seen_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `enrolled_from_migration` tinyint(1) unsigned NOT NULL DEFAULT '0', + `token_update_tally` int NOT NULL DEFAULT '1', + `last_seen_at` timestamp NOT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `enrolled_from_migration` tinyint unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `user_id` (`user_id`), KEY `device_id` (`device_id`), KEY `type` (`type`), CONSTRAINT `nano_enrollments_ibfk_1` FOREIGN KEY (`device_id`) REFERENCES `nano_devices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `nano_enrollments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `nano_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + CONSTRAINT `nano_enrollments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `nano_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `nano_enrollments_chk_1` CHECK ((`id` <> _utf8mb4'')), + CONSTRAINT `nano_enrollments_chk_2` CHECK ((`type` <> _utf8mb4'')), + CONSTRAINT `nano_enrollments_chk_3` CHECK ((`topic` <> _utf8mb4'')), + CONSTRAINT `nano_enrollments_chk_4` CHECK ((`push_magic` <> _utf8mb4'')), + CONSTRAINT `nano_enrollments_chk_5` CHECK ((`token_hex` <> _utf8mb4'')) +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `nano_push_certs` ( `topic` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `cert_pem` text COLLATE utf8mb4_unicode_ci NOT NULL, `key_pem` text COLLATE utf8mb4_unicode_ci NOT NULL, - `stale_token` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`topic`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + `stale_token` int NOT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`topic`), + CONSTRAINT `nano_push_certs_chk_1` CHECK ((`topic` <> _utf8mb4'')), + CONSTRAINT `nano_push_certs_chk_2` CHECK ((substr(`cert_pem`,1,27) = _utf8mb4'-----BEGIN CERTIFICATE-----')), + CONSTRAINT `nano_push_certs_chk_3` CHECK ((substr(`key_pem`,1,5) = _utf8mb4'-----')) +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `nano_users` ( `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `device_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, @@ -1122,15 +1146,20 @@ CREATE TABLE `nano_users` ( `user_authenticate_at` timestamp NULL DEFAULT NULL, `user_authenticate_digest` text COLLATE utf8mb4_unicode_ci, `user_authenticate_digest_at` timestamp NULL DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`,`device_id`), KEY `device_id` (`device_id`), - CONSTRAINT `nano_users_ibfk_1` FOREIGN KEY (`device_id`) REFERENCES `nano_devices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + CONSTRAINT `nano_users_ibfk_1` FOREIGN KEY (`device_id`) REFERENCES `nano_devices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `nano_users_chk_1` CHECK (((`user_short_name` is null) or (`user_short_name` <> _utf8mb4''))), + CONSTRAINT `nano_users_chk_2` CHECK (((`user_long_name` is null) or (`user_long_name` <> _utf8mb4''))), + CONSTRAINT `nano_users_chk_3` CHECK (((`token_update` is null) or (`token_update` <> _utf8mb4''))), + CONSTRAINT `nano_users_chk_4` CHECK (((`user_authenticate` is null) or (`user_authenticate` <> _utf8mb4''))), + CONSTRAINT `nano_users_chk_5` CHECK (((`user_authenticate_digest` is null) or (`user_authenticate_digest` <> _utf8mb4''))) +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!50503 SET character_set_client = utf8mb4 */; /*!50001 CREATE VIEW `nano_view_queue` AS SELECT 1 AS `id`, 1 AS `created_at`, @@ -1144,92 +1173,92 @@ SET character_set_client = utf8; 1 AS `result`*/; SET character_set_client = @saved_cs_client; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `network_interfaces` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `host_id` int(10) unsigned NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `host_id` int unsigned NOT NULL, `mac` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `ip_address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `broadcast` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `ibytes` bigint(20) NOT NULL DEFAULT '0', + `ibytes` bigint NOT NULL DEFAULT '0', `interface` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `ipackets` bigint(20) NOT NULL DEFAULT '0', - `last_change` bigint(20) NOT NULL DEFAULT '0', + `ipackets` bigint NOT NULL DEFAULT '0', + `last_change` bigint NOT NULL DEFAULT '0', `mask` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `metric` int(11) NOT NULL DEFAULT '0', - `mtu` int(11) NOT NULL DEFAULT '0', - `obytes` bigint(20) NOT NULL DEFAULT '0', - `ierrors` bigint(20) NOT NULL DEFAULT '0', - `oerrors` bigint(20) NOT NULL DEFAULT '0', - `opackets` bigint(20) NOT NULL DEFAULT '0', + `metric` int NOT NULL DEFAULT '0', + `mtu` int NOT NULL DEFAULT '0', + `obytes` bigint NOT NULL DEFAULT '0', + `ierrors` bigint NOT NULL DEFAULT '0', + `oerrors` bigint NOT NULL DEFAULT '0', + `opackets` bigint NOT NULL DEFAULT '0', `point_to_point` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `type` int(11) NOT NULL DEFAULT '0', - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `type` int NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `idx_network_interfaces_unique_ip_host_intf` (`ip_address`,`host_id`,`interface`), KEY `idx_network_interfaces_hosts_fk` (`host_id`), FULLTEXT KEY `ip_address_search` (`ip_address`), CONSTRAINT `network_interfaces_ibfk_1` FOREIGN KEY (`host_id`) REFERENCES `hosts` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `operating_system_vulnerabilities` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `operating_system_id` int(10) unsigned NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `operating_system_id` int unsigned NOT NULL, `cve` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `source` smallint(6) DEFAULT '0', + `source` smallint DEFAULT '0', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `resolved_in_version` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `resolved_in_version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `idx_os_vulnerabilities_unq_os_id_cve` (`operating_system_id`,`cve`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `operating_systems` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `version` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL, `arch` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL, `kernel_version` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL, `platform` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, - `display_version` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `os_version_id` int(10) unsigned DEFAULT NULL, + `display_version` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `os_version_id` int unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_unique_os` (`name`,`version`,`arch`,`kernel_version`,`platform`,`display_version`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `osquery_options` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `override_type` int(1) NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `override_type` int NOT NULL, `override_identifier` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `options` json NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `osquery_options` VALUES (1,0,'','{\"options\": {\"logger_plugin\": \"tls\", \"pack_delimiter\": \"/\", \"logger_tls_period\": 10, \"distributed_plugin\": \"tls\", \"disable_distributed\": false, \"logger_tls_endpoint\": \"/api/v1/osquery/log\", \"distributed_interval\": 10, \"distributed_tls_max_attempts\": 3}, \"decorators\": {\"load\": [\"SELECT uuid AS host_uuid FROM system_info;\", \"SELECT hostname AS hostname FROM system_info;\"]}}'); /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `pack_targets` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `pack_id` int(10) unsigned DEFAULT NULL, - `type` int(11) DEFAULT NULL, - `target_id` int(10) unsigned NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `pack_id` int unsigned DEFAULT NULL, + `type` int DEFAULT NULL, + `target_id` int unsigned NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `constraint_pack_target_unique` (`pack_id`,`target_id`,`type`), CONSTRAINT `pack_targets_ibfk_1` FOREIGN KEY (`pack_id`) REFERENCES `packs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `packs` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `disabled` tinyint(1) NOT NULL DEFAULT '0', `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, @@ -1238,77 +1267,77 @@ CREATE TABLE `packs` ( `pack_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_pack_unique_name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `password_reset_requests` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `expires_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `expires_at` timestamp NOT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `user_id` int(10) unsigned NOT NULL, + `user_id` int unsigned NOT NULL, `token` varchar(1024) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `policies` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `team_id` int(10) unsigned DEFAULT NULL, + `team_id` int unsigned DEFAULT NULL, `resolution` text COLLATE utf8mb4_unicode_ci, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `query` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `description` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, - `author_id` int(10) unsigned DEFAULT NULL, + `author_id` int unsigned DEFAULT NULL, `platforms` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `critical` tinyint(1) NOT NULL DEFAULT '0', `checksum` binary(16) NOT NULL, - `calendar_events_enabled` tinyint(1) unsigned NOT NULL DEFAULT '0', + `calendar_events_enabled` tinyint unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `idx_policies_checksum` (`checksum`), KEY `idx_policies_author_id` (`author_id`), KEY `idx_policies_team_id` (`team_id`), CONSTRAINT `policies_ibfk_2` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `policies_queries_ibfk_1` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`) ON DELETE SET NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `policy_automation_iterations` ( - `policy_id` int(10) unsigned NOT NULL, - `iteration` int(11) NOT NULL, + `policy_id` int unsigned NOT NULL, + `iteration` int NOT NULL, PRIMARY KEY (`policy_id`), CONSTRAINT `policy_automation_iterations_ibfk_1` FOREIGN KEY (`policy_id`) REFERENCES `policies` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `policy_membership` ( - `policy_id` int(10) unsigned NOT NULL, - `host_id` int(10) unsigned NOT NULL, + `policy_id` int unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `passes` tinyint(1) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `automation_iteration` int(11) DEFAULT NULL, + `automation_iteration` int DEFAULT NULL, PRIMARY KEY (`policy_id`,`host_id`), KEY `idx_policy_membership_passes` (`passes`), KEY `idx_policy_membership_policy_id` (`policy_id`), KEY `idx_policy_membership_host_id_passes` (`host_id`,`passes`), CONSTRAINT `policy_membership_ibfk_1` FOREIGN KEY (`policy_id`) REFERENCES `policies` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `policy_stats` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `policy_id` int(10) unsigned NOT NULL, - `inherited_team_id` int(10) unsigned NOT NULL DEFAULT '0', - `passing_host_count` mediumint(8) unsigned NOT NULL DEFAULT '0', - `failing_host_count` mediumint(8) unsigned NOT NULL DEFAULT '0', + `id` int unsigned NOT NULL AUTO_INCREMENT, + `policy_id` int unsigned NOT NULL, + `inherited_team_id` int unsigned NOT NULL DEFAULT '0', + `passing_host_count` mediumint unsigned NOT NULL DEFAULT '0', + `failing_host_count` mediumint unsigned NOT NULL DEFAULT '0', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), @@ -1317,23 +1346,23 @@ CREATE TABLE `policy_stats` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `queries` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `saved` tinyint(1) NOT NULL DEFAULT '0', `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `description` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `query` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, - `author_id` int(10) unsigned DEFAULT NULL, + `author_id` int unsigned DEFAULT NULL, `observer_can_run` tinyint(1) NOT NULL DEFAULT '0', - `team_id` int(10) unsigned DEFAULT NULL, + `team_id` int unsigned DEFAULT NULL, `team_id_char` char(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `platform` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `min_osquery_version` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `schedule_interval` int(10) unsigned NOT NULL DEFAULT '0', - `automations_enabled` tinyint(1) unsigned NOT NULL DEFAULT '0', + `schedule_interval` int unsigned NOT NULL DEFAULT '0', + `automations_enabled` tinyint unsigned NOT NULL DEFAULT '0', `logging_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'snapshot', `discard_data` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), @@ -1343,59 +1372,61 @@ CREATE TABLE `queries` ( KEY `idx_team_id_saved_auto_interval` (`team_id`,`saved`,`automations_enabled`,`schedule_interval`), CONSTRAINT `queries_ibfk_1` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`) ON DELETE SET NULL, CONSTRAINT `queries_ibfk_2` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `query_results` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `query_id` int(10) unsigned NOT NULL, - `host_id` int(10) unsigned NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `query_id` int unsigned NOT NULL, + `host_id` int unsigned NOT NULL, `osquery_version` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `error` text COLLATE utf8mb4_unicode_ci, - `last_fetched` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `error` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `last_fetched` timestamp NOT NULL, `data` json DEFAULT NULL, PRIMARY KEY (`id`), KEY `query_id` (`query_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `scep_certificates` ( - `serial` bigint(20) NOT NULL, + `serial` bigint NOT NULL, `name` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `not_valid_before` datetime NOT NULL, `not_valid_after` datetime NOT NULL, `certificate_pem` text COLLATE utf8mb4_unicode_ci NOT NULL, `revoked` tinyint(1) NOT NULL DEFAULT '0', - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`serial`), - CONSTRAINT `scep_certificates_ibfk_1` FOREIGN KEY (`serial`) REFERENCES `scep_serials` (`serial`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `scep_serials` ( - `serial` bigint(20) NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`serial`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `scheduled_queries` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `pack_id` int(10) unsigned DEFAULT NULL, - `query_id` int(10) unsigned DEFAULT NULL, - `interval` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`serial`), + CONSTRAINT `scep_certificates_ibfk_1` FOREIGN KEY (`serial`) REFERENCES `scep_serials` (`serial`), + CONSTRAINT `scep_certificates_chk_1` CHECK ((substr(`certificate_pem`,1,27) = _utf8mb4'-----BEGIN CERTIFICATE-----')), + CONSTRAINT `scep_certificates_chk_2` CHECK (((`name` is null) or (`name` <> _utf8mb4''))) +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `scep_serials` ( + `serial` bigint NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`serial`) +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `scheduled_queries` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `pack_id` int unsigned DEFAULT NULL, + `query_id` int unsigned DEFAULT NULL, + `interval` int unsigned DEFAULT NULL, `snapshot` tinyint(1) DEFAULT NULL, `removed` tinyint(1) DEFAULT NULL, `platform` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '', `version` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '', - `shard` int(10) unsigned DEFAULT NULL, + `shard` int unsigned DEFAULT NULL, `query_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `description` varchar(1023) COLLATE utf8mb4_unicode_ci DEFAULT '', @@ -1408,72 +1439,72 @@ CREATE TABLE `scheduled_queries` ( KEY `fk_scheduled_queries_queries` (`team_id_char`,`query_name`), CONSTRAINT `scheduled_queries_ibfk_1` FOREIGN KEY (`team_id_char`, `query_name`) REFERENCES `queries` (`team_id_char`, `name`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `scheduled_queries_pack_id` FOREIGN KEY (`pack_id`) REFERENCES `packs` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `scheduled_query_stats` ( - `host_id` int(10) unsigned NOT NULL, - `scheduled_query_id` int(10) unsigned NOT NULL, - `average_memory` bigint(20) unsigned NOT NULL, + `host_id` int unsigned NOT NULL, + `scheduled_query_id` int unsigned NOT NULL, + `average_memory` bigint unsigned NOT NULL, `denylisted` tinyint(1) DEFAULT NULL, - `executions` bigint(20) unsigned NOT NULL, - `schedule_interval` int(11) DEFAULT NULL, - `last_executed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `output_size` bigint(20) unsigned NOT NULL, - `system_time` bigint(20) unsigned NOT NULL, - `user_time` bigint(20) unsigned NOT NULL, - `wall_time` bigint(20) unsigned NOT NULL, - `query_type` tinyint(4) NOT NULL DEFAULT '0', + `executions` bigint unsigned NOT NULL, + `schedule_interval` int DEFAULT NULL, + `last_executed` timestamp NULL DEFAULT NULL, + `output_size` bigint unsigned NOT NULL, + `system_time` bigint unsigned NOT NULL, + `user_time` bigint unsigned NOT NULL, + `wall_time` bigint unsigned NOT NULL, + `query_type` tinyint NOT NULL DEFAULT '0', PRIMARY KEY (`host_id`,`scheduled_query_id`,`query_type`), KEY `scheduled_query_id` (`scheduled_query_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `script_contents` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `md5_checksum` binary(16) NOT NULL, - `contents` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, + `contents` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `idx_script_contents_md5_checksum` (`md5_checksum`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `scripts` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `team_id` int(10) unsigned DEFAULT NULL, - `global_or_team_id` int(10) unsigned NOT NULL DEFAULT '0', + `id` int unsigned NOT NULL AUTO_INCREMENT, + `team_id` int unsigned DEFAULT NULL, + `global_or_team_id` int unsigned NOT NULL DEFAULT '0', `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `script_content_id` int(10) unsigned DEFAULT NULL, + `script_content_id` int unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_scripts_global_or_team_id_name` (`global_or_team_id`,`name`), UNIQUE KEY `idx_scripts_team_name` (`team_id`,`name`), KEY `script_content_id` (`script_content_id`), CONSTRAINT `scripts_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `scripts_ibfk_2` FOREIGN KEY (`script_content_id`) REFERENCES `script_contents` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `sessions` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `accessed_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `user_id` int(10) unsigned NOT NULL, + `user_id` int unsigned NOT NULL, `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_session_unique_key` (`key`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `software` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `id` bigint unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `version` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `source` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, @@ -1484,7 +1515,7 @@ CREATE TABLE `software` ( `vendor` varchar(114) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `browser` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `extension_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `title_id` int(10) unsigned DEFAULT NULL, + `title_id` int unsigned DEFAULT NULL, `checksum` binary(16) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_software_checksum` (`checksum`), @@ -1492,64 +1523,64 @@ CREATE TABLE `software` ( KEY `software_source_vendor_idx` (`source`,`vendor_old`), KEY `title_id` (`title_id`), KEY `idx_sw_name_source_browser` (`name`,`source`,`browser`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `software_cpe` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `software_id` bigint(20) unsigned DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `software_id` bigint unsigned DEFAULT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `cpe` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `unq_software_id` (`software_id`), KEY `software_cpe_cpe_idx` (`cpe`), CONSTRAINT `software_cpe_ibfk_1` FOREIGN KEY (`software_id`) REFERENCES `software` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `software_cve` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `cve` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `source` int(11) DEFAULT '0', - `software_id` bigint(20) unsigned DEFAULT NULL, - `resolved_in_version` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `source` int DEFAULT '0', + `software_id` bigint unsigned DEFAULT NULL, + `resolved_in_version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `unq_software_id_cve` (`software_id`,`cve`), KEY `software_cve_software_id` (`software_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `software_host_counts` ( - `software_id` bigint(20) unsigned NOT NULL, - `hosts_count` int(10) unsigned NOT NULL, + `software_id` bigint unsigned NOT NULL, + `hosts_count` int unsigned NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `team_id` int(10) unsigned NOT NULL DEFAULT '0', + `team_id` int unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`software_id`,`team_id`), KEY `idx_software_host_counts_updated_at_software_id` (`updated_at`,`software_id`), KEY `idx_software_host_counts_team_id_hosts_count_software_id` (`team_id`,`hosts_count`,`software_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `software_installers` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `team_id` int(10) unsigned DEFAULT NULL, - `global_or_team_id` int(10) unsigned NOT NULL DEFAULT '0', - `title_id` int(10) unsigned DEFAULT NULL, - `filename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `version` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `platform` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `pre_install_query` text COLLATE utf8mb4_unicode_ci, - `install_script_content_id` int(10) unsigned NOT NULL, - `post_install_script_content_id` int(10) unsigned DEFAULT NULL, - `storage_id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `team_id` int unsigned DEFAULT NULL, + `global_or_team_id` int unsigned NOT NULL DEFAULT '0', + `title_id` int unsigned DEFAULT NULL, + `filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `platform` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `pre_install_query` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `install_script_content_id` int unsigned NOT NULL, + `post_install_script_content_id` int unsigned DEFAULT NULL, + `storage_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `uploaded_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `self_service` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), @@ -1559,31 +1590,31 @@ CREATE TABLE `software_installers` ( KEY `fk_software_installers_post_install_script_content_id` (`post_install_script_content_id`), KEY `fk_software_installers_team_id` (`team_id`), KEY `idx_software_installers_platform_title_id` (`platform`,`title_id`), - CONSTRAINT `fk_software_installers_install_script_content_id` FOREIGN KEY (`install_script_content_id`) REFERENCES `script_contents` (`id`) ON UPDATE CASCADE, - CONSTRAINT `fk_software_installers_post_install_script_content_id` FOREIGN KEY (`post_install_script_content_id`) REFERENCES `script_contents` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fk_software_installers_install_script_content_id` FOREIGN KEY (`install_script_content_id`) REFERENCES `script_contents` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE, + CONSTRAINT `fk_software_installers_post_install_script_content_id` FOREIGN KEY (`post_install_script_content_id`) REFERENCES `script_contents` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT `fk_software_installers_team_id` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_software_installers_title` FOREIGN KEY (`title_id`) REFERENCES `software_titles` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `software_titles` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `source` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, - `browser` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `bundle_identifier` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `browser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `bundle_identifier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_sw_titles` (`name`,`source`,`browser`), UNIQUE KEY `idx_software_titles_bundle_identifier` (`bundle_identifier`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `software_titles_host_counts` ( - `software_title_id` int(10) unsigned NOT NULL, - `hosts_count` int(10) unsigned NOT NULL, - `team_id` int(10) unsigned NOT NULL DEFAULT '0', + `software_title_id` int unsigned NOT NULL, + `hosts_count` int unsigned NOT NULL, + `team_id` int unsigned NOT NULL DEFAULT '0', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`software_title_id`,`team_id`), @@ -1592,47 +1623,47 @@ CREATE TABLE `software_titles_host_counts` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `statistics` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `anonymous_identifier` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `teams` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `description` varchar(1023) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `config` json DEFAULT NULL, `name_bin` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin GENERATED ALWAYS AS (`name`) VIRTUAL, - `filename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_teams_filename` (`filename`), UNIQUE KEY `idx_name_bin` (`name_bin`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `user_teams` ( - `user_id` int(10) unsigned NOT NULL, - `team_id` int(10) unsigned NOT NULL, + `user_id` int unsigned NOT NULL, + `team_id` int unsigned NOT NULL, `role` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`user_id`,`team_id`), KEY `fk_user_teams_team_id` (`team_id`), CONSTRAINT `user_teams_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `user_teams_ibfk_2` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `users` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `password` varbinary(255) NOT NULL, `salt` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, @@ -1641,31 +1672,31 @@ CREATE TABLE `users` ( `admin_forced_password_reset` tinyint(1) NOT NULL DEFAULT '0', `gravatar_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `position` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `sso_enabled` tinyint(4) NOT NULL DEFAULT '0', + `sso_enabled` tinyint NOT NULL DEFAULT '0', `global_role` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `api_only` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `idx_user_unique_email` (`email`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `vulnerability_host_counts` ( `cve` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL, - `team_id` int(10) unsigned NOT NULL DEFAULT '0', - `host_count` int(10) unsigned NOT NULL DEFAULT '0', - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `team_id` int unsigned NOT NULL DEFAULT '0', + `host_count` int unsigned NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, UNIQUE KEY `cve_team_id` (`cve`,`team_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `windows_mdm_command_queue` ( - `enrollment_id` int(10) unsigned NOT NULL, + `enrollment_id` int unsigned NOT NULL, `command_uuid` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`enrollment_id`,`command_uuid`), KEY `command_uuid` (`command_uuid`), CONSTRAINT `windows_mdm_command_queue_ibfk_1` FOREIGN KEY (`enrollment_id`) REFERENCES `mdm_windows_enrollments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, @@ -1673,15 +1704,15 @@ CREATE TABLE `windows_mdm_command_queue` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `windows_mdm_command_results` ( - `enrollment_id` int(10) unsigned NOT NULL, + `enrollment_id` int unsigned NOT NULL, `command_uuid` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL, `raw_result` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, - `response_id` int(10) unsigned NOT NULL, + `response_id` int unsigned NOT NULL, `status_code` varchar(31) COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`enrollment_id`,`command_uuid`), KEY `command_uuid` (`command_uuid`), KEY `response_id` (`response_id`), @@ -1691,43 +1722,43 @@ CREATE TABLE `windows_mdm_command_results` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `windows_mdm_commands` ( `command_uuid` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL, `raw_command` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `target_loc_uri` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`command_uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `windows_mdm_responses` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `enrollment_id` int(10) unsigned NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `enrollment_id` int unsigned NOT NULL, `raw_response` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `enrollment_id` (`enrollment_id`), CONSTRAINT `windows_mdm_responses_ibfk_1` FOREIGN KEY (`enrollment_id`) REFERENCES `mdm_windows_enrollments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `windows_updates` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `host_id` int(10) unsigned NOT NULL, - `date_epoch` int(10) unsigned NOT NULL, - `kb_id` int(10) unsigned NOT NULL, + `id` int unsigned NOT NULL AUTO_INCREMENT, + `host_id` int unsigned NOT NULL, + `date_epoch` int unsigned NOT NULL, + `kb_id` int unsigned NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_unique_windows_updates` (`host_id`,`kb_id`), KEY `idx_update_date` (`host_id`,`date_epoch`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `wstep_cert_auth_associations` ( `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `sha256` char(64) COLLATE utf8mb4_unicode_ci NOT NULL, @@ -1737,9 +1768,9 @@ CREATE TABLE `wstep_cert_auth_associations` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `wstep_certificates` ( - `serial` bigint(20) unsigned NOT NULL, + `serial` bigint unsigned NOT NULL, `name` varchar(1024) COLLATE utf8mb4_unicode_ci NOT NULL, `not_valid_before` datetime NOT NULL, `not_valid_after` datetime NOT NULL, @@ -1752,12 +1783,12 @@ CREATE TABLE `wstep_certificates` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `wstep_serials` ( - `serial` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `serial` bigint unsigned NOT NULL AUTO_INCREMENT, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`serial`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50001 DROP VIEW IF EXISTS `nano_view_queue`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; diff --git a/server/service/handler_test.go b/server/service/handler_test.go index faaf9d0ae5..df7ff9e04d 100644 --- a/server/service/handler_test.go +++ b/server/service/handler_test.go @@ -37,7 +37,7 @@ func TestAPIRoutesConflicts(t *testing.T) { } var cases []testCase - // build the test cases: for each route, generate a request designed to match + // Build the test cases: for each route, generate a request designed to match // it, and override its handler to return a unique status code. If the // request doesn't result in that status code, then some other route // conflicts with it and took precedence - a route conflict. The route's name diff --git a/server/service/hosts.go b/server/service/hosts.go index 4bddef07c1..4de8dd091a 100644 --- a/server/service/hosts.go +++ b/server/service/hosts.go @@ -994,7 +994,9 @@ type refetchHostResponse struct { Err error `json:"error,omitempty"` } -func (r refetchHostResponse) error() error { return r.Err } +func (r refetchHostResponse) error() error { + return r.Err +} func refetchHostEndpoint(ctx context.Context, request interface{}, svc fleet.Service) (errorer, error) { req := request.(*refetchHostRequest) diff --git a/test/upgrade/docker-compose.yaml b/test/upgrade/docker-compose.yaml index 6d8a33a1bc..ac703c2108 100644 --- a/test/upgrade/docker-compose.yaml +++ b/test/upgrade/docker-compose.yaml @@ -1,7 +1,7 @@ services: mysql: platform: ${FLEET_MYSQL_PLATFORM:-linux/x86_64} - image: mysql:5.7 + image: mysql:8.0.36 environment: MYSQL_ROOT_PASSWORD: toor MYSQL_DATABASE: fleet diff --git a/tools/backup_db/backup.sh b/tools/backup_db/backup.sh index eb9d179eec..03c7a29b42 100755 --- a/tools/backup_db/backup.sh +++ b/tools/backup_db/backup.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -euo pipefail -docker run --rm --network fleet_default ${FLEET_MYSQL_IMAGE:-mysql:5.7} bash -c 'mysqldump -hmysql -uroot -ptoor --default-character-set=utf8mb4 fleet | gzip -' > backup.sql.gz +docker run --rm --network fleet_default ${FLEET_MYSQL_IMAGE:-mysql:8.0.36} bash -c 'mysqldump -hmysql -uroot -ptoor --default-character-set=utf8mb4 fleet | gzip -' > backup.sql.gz diff --git a/tools/backup_db/restore.sh b/tools/backup_db/restore.sh index 1270430782..a95dafc671 100755 --- a/tools/backup_db/restore.sh +++ b/tools/backup_db/restore.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -euo pipefail -docker run --rm -i --network fleet_default ${FLEET_MYSQL_IMAGE:-mysql:5.7} bash -c 'gzip -dc - | mysql -hmysql -uroot -ptoor fleet' < backup.sql.gz +docker run --rm -i --network fleet_default ${FLEET_MYSQL_IMAGE:-mysql:8.0.36} bash -c 'gzip -dc - | mysql -hmysql -uroot -ptoor fleet' < backup.sql.gz diff --git a/tools/backup_db/restore_e2e_software_test.sh b/tools/backup_db/restore_e2e_software_test.sh index 5ab60f4fe0..97af6ad1c1 100755 --- a/tools/backup_db/restore_e2e_software_test.sh +++ b/tools/backup_db/restore_e2e_software_test.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash set -euo pipefail -docker run --rm -i --network fleet_default mysql:5.7 bash -c 'gzip -kdc - | mysql -hmysql_test -uroot -ptoor e2e' < tools/testdata/e2e_software_test.sql.gz - +docker run --rm -i --network fleet_default mysql:8.0.36 bash -c 'gzip -kdc - | mysql -hmysql_test -uroot -ptoor e2e' < tools/testdata/e2e_software_test.sql.gz diff --git a/tools/mysql-replica-testing/docker-compose.yml b/tools/mysql-replica-testing/docker-compose.yml index 534874c265..f5f4ab91c2 100644 --- a/tools/mysql-replica-testing/docker-compose.yml +++ b/tools/mysql-replica-testing/docker-compose.yml @@ -2,7 +2,7 @@ version: "2" services: mysql_main: - image: ${FLEET_MYSQL_IMAGE:-mysql:5.7} + image: ${FLEET_MYSQL_IMAGE:-mysql:8.0.36} platform: ${FLEET_MYSQL_PLATFORM:-linux/x86_64} volumes: - mysql-persistent-volume-replica-main:/tmp @@ -27,7 +27,7 @@ services: - "3308:3306" mysql_read_replica: - image: ${FLEET_MYSQL_IMAGE:-mysql:5.7} + image: ${FLEET_MYSQL_IMAGE:-mysql:8.0.36} platform: ${FLEET_MYSQL_PLATFORM:-linux/x86_64} volumes: - mysql-persistent-volume-replica-read:/tmp diff --git a/tools/osquery/in-a-box/docker-compose.yml b/tools/osquery/in-a-box/docker-compose.yml index 7d7d1a3483..146a2be172 100644 --- a/tools/osquery/in-a-box/docker-compose.yml +++ b/tools/osquery/in-a-box/docker-compose.yml @@ -8,7 +8,7 @@ networks: services: mysql01: - image: mysql:5.7 + image: mysql:8.0.36 platform: linux/x86_64 volumes: - .:/data diff --git a/tools/percona/test/upgrade.sh b/tools/percona/test/upgrade.sh index 62fafa6b28..f1a01d6108 100755 --- a/tools/percona/test/upgrade.sh +++ b/tools/percona/test/upgrade.sh @@ -12,7 +12,7 @@ docker volume rm fleet_mysql-persistent-volume # Start dependencies using Percona XtraDB as MySQL server. # NOTE: To troubleshoot, remove `>/dev/null`. -FLEET_MYSQL_IMAGE=percona/percona-xtradb-cluster:5.7.25 docker compose up >/dev/null 2>&1 & +FLEET_MYSQL_IMAGE=percona/percona-xtradb-cluster:8.0.36 docker compose up >/dev/null 2>&1 & export MYSQL_PWD=toor @@ -39,4 +39,4 @@ mysql --host 127.0.0.1 --port 3306 -uroot -e 'SET GLOBAL pxc_strict_mode=ENFORCI # Run migrations from fleet-v4.42.0 up to latest to catch any future bugs when running with `pxc_strict_mode=ENFORCING`. git checkout main make generate && make fleet -./build/fleet prepare db --dev --logging_debug \ No newline at end of file +./build/fleet prepare db --dev --logging_debug From c762ac4c8ce5d4bce997ade727193e1bef3e6bc4 Mon Sep 17 00:00:00 2001 From: Sam Pfluger <108141731+Sampfluger88@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:51:19 -0500 Subject: [PATCH 7/7] Update digital-experience.rituals.yml (#20642) --- .../digital-experience/digital-experience.rituals.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/handbook/digital-experience/digital-experience.rituals.yml b/handbook/digital-experience/digital-experience.rituals.yml index a0ecdf9c53..d7dca56f0e 100644 --- a/handbook/digital-experience/digital-experience.rituals.yml +++ b/handbook/digital-experience/digital-experience.rituals.yml @@ -28,16 +28,6 @@ autoIssue: labels: [ "#g-digital-experience" ] repo: fleet -- - task: "Generate latest schema" - startedOn: "2024-02-19" - frequency: "Weekly" - description: "After each sprint, generate the latest tables json file to incorporate any new schema documentation." - moreInfoUrl: https://fleetdm.com/handbook/company/product-groups#changes-to-tables-schema - dri: "eashaw" - autoIssue: - labels: [ "#g-digital-experience" ] - repo: fleet - task: "Check osquery Slack invitation" startedOn: "2023-11-10"