From 9d2b07f76fb4df66f445e23df8d0c81d71f62ed4 Mon Sep 17 00:00:00 2001 From: Jahziel Villasana-Espinoza Date: Thu, 29 May 2025 17:00:30 -0400 Subject: [PATCH] add a test that checks collation on new migrations (#29309) > closes #26403 # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] If database migrations are included, checked table schema to confirm autoupdate - For database migrations: - [x] Ensured the correct collation is explicitly set for character columns (`COLLATE utf8mb4_unicode_ci`). - [x] Added/updated automated tests - [x] Manual QA for all new/changed functionality --- .github/workflows/test-db-changes.yml | 27 ++++---- changes/26403-db-collation | 2 + .../tables/20161118212528_CreateTableHosts.go | 38 ++++++------ .../20161118212538_CreateTableInvites.go | 2 +- .../20161118212557_CreateTableLabels.go | 2 +- ...61118212613_CreateTableScheduledQueries.go | 2 +- .../tables/20161118212630_CreateTablePacks.go | 2 +- ...212641_CreateTablePasswordResetRequests.go | 2 +- .../tables/20161118212649_CreateTableUsers.go | 2 +- .../20161118212656_CreateTableSessions.go | 2 +- .../20161118212758_CreateTableQueries.go | 2 +- ...1128234849_CreateTableNetworkInterfaces.go | 2 +- .../20170124230432_CreateTableEmailChanges.go | 2 +- .../tables/20170306075207_UseUTF8MB.go | 8 ++- ...0171116163618_CreateTableOsqueryOptions.go | 2 +- .../20171219164727_UpdateScheduledQueryKey.go | 4 +- .../tables/20200311140000_AddHostMacAndIp.go | 4 +- ...20200512120000_CreateTableEnrollSecrets.go | 4 +- .../20201021104586_CreateCarveTables.go | 2 +- .../20210421112652_AddSoftwareInventory.go | 2 +- .../20210601000001_CreateTeamsTables.go | 6 +- .../20210601000002_AddRolesToInvites.go | 2 +- .../tables/20210708143152_AddHostUsers.go | 2 +- .../20210709124443_CreateActivitiesTable.go | 3 +- .../tables/20210712155608_CreateLocksTable.go | 3 +- .../20210719153709_AddStatisticsTable.go | 2 +- .../tables/20210721171531_AddCPETable.go | 2 +- .../tables/20210802135933_AddCVETable.go | 2 +- .../tables/20210819143446_AddPolicies.go | 2 +- .../20211013133707_AddAggregatedStats.go | 2 +- .../20211216131203_AddMDMMunkiTables.go | 4 +- .../20211221110132_AddHostEmailsTable.go | 2 +- .../20220307104655_AddHostDeviceAuth.go | 2 +- .../tables/20220316155700_AddPublicIPHosts.go | 3 +- .../tables/20220330100659_AddJobsTable.go | 2 +- .../20220503134048_AddCVEScoresTable.go | 2 +- .../20220627104817_AddHostBatteriesTable.go | 2 +- ...20220713091130_AddOperatingSystemsTable.go | 2 +- ...02135510_AddMobileDeviceManagementTable.go | 2 +- .../20220822161445_CreateMunkiIssuesTable.go | 2 +- ...20908181826_AddOrbitNodeKeyToHosts_test.go | 2 +- .../tables/20220915165115_AppleMDMTables.go | 4 +- .../20220915165115_AppleMDMTables_nanodep.sql | 2 +- .../20220915165115_AppleMDMTables_nanomdm.sql | 20 +++--- .../20220915165115_AppleMDMTables_scep.sql | 2 +- .../tables/20220915165116_HostDisplayName.go | 4 +- ...20221014084130_CreateHostOrbitInfoTable.go | 2 +- ...eateOperatingSystemVulnerabilitiesTable.go | 2 +- .../20221115104546_AddCronStatsTable.go | 4 +- ...07_AlterHostsTablePendingMDMEnrollments.go | 2 +- ...24725_CreateHostDiskEncryptionKeysTable.go | 2 +- ...06163608_AddTableMDMAppleConfigProfiles.go | 2 +- ...0214131519_AddHostMDMAppleProfilesTable.go | 6 +- .../20230303135738_AddMDMIdPAccountsTable.go | 2 +- ...leNameColumnToHostMDMAppleProfilesTable.go | 2 +- .../20230315104937_EnsureUniformCollation.go | 17 +++-- ...102858_CreateHostBootstrapPackagesTable.go | 4 +- ...114155_AddFullnameToMDMIdPAccountsTable.go | 2 +- .../20230721135421_QueriesSchemaChanges.go | 6 +- .../20250127162751_AddUnifiedQueueTable.go | 16 +++-- .../20250501162727_AddSoftwareCategories.go | 4 +- .../20250529102706_SetMediumTextColumns.go | 33 ++++++++++ .../mysql/migrations/tables/collation_test.go | 31 ++++++++++ .../mysql/migrations/tables/migration_test.go | 30 +++++++++ server/datastore/mysql/schema.sql | 62 +++++++++---------- 65 files changed, 271 insertions(+), 154 deletions(-) create mode 100644 changes/26403-db-collation create mode 100644 server/datastore/mysql/migrations/tables/20250529102706_SetMediumTextColumns.go create mode 100644 server/datastore/mysql/migrations/tables/collation_test.go diff --git a/.github/workflows/test-db-changes.yml b/.github/workflows/test-db-changes.yml index 834621be64..13f467e3d3 100644 --- a/.github/workflows/test-db-changes.yml +++ b/.github/workflows/test-db-changes.yml @@ -72,20 +72,6 @@ jobs: index=$((index+1)) done - - name: Prevent hosts foreign keys - run: | - # grep exits with an error code if it doesn't find a match, so this condition - # is only true if it a) finds a matching migrations file in the diff, and b) - # finds an FK to hosts in one of the migrations files. - # - # grep prints the matches, which will help figure out where those references are. - if git diff --name-only origin/main | grep "migrations/" | xargs grep -i -E 'references\s*hosts\s*\(\s*id\s*\)' ; then - echo "❌ fail: hosts foreign keys are not allowed" - echo "Ref: https://github.com/fleetdm/fleet/blob/main/handbook/engineering/scaling-fleet.md#foreign-keys-and-locking" - exit 1 - fi - - - name: Install Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: @@ -112,3 +98,16 @@ jobs: echo "please run 'make test-schema' and commit the changes" exit 1 fi + + - name: Prevent hosts foreign keys + run: | + # grep exits with an error code if it doesn't find a match, so this condition + # is only true if it a) finds a matching migrations file in the diff, and b) + # finds an FK to hosts in one of the migrations files. + # + # grep prints the matches, which will help figure out where those references are. + if git diff --name-only origin/main | grep "migrations/" | xargs grep -i -E 'references\s*hosts\s*\(\s*id\s*\)' ; then + echo "❌ fail: hosts foreign keys are not allowed" + echo "Ref: https://github.com/fleetdm/fleet/blob/main/handbook/engineering/scaling-fleet.md#foreign-keys-and-locking" + exit 1 + fi diff --git a/changes/26403-db-collation b/changes/26403-db-collation new file mode 100644 index 0000000000..eff6b37041 --- /dev/null +++ b/changes/26403-db-collation @@ -0,0 +1,2 @@ +- Updated migrations to use the `utf8mb4_unicode_ci` collation across all tables and added a test to + validate that new migrations use this collation. \ No newline at end of file diff --git a/server/datastore/mysql/migrations/tables/20161118212528_CreateTableHosts.go b/server/datastore/mysql/migrations/tables/20161118212528_CreateTableHosts.go index 12484587c3..d0db7226c8 100644 --- a/server/datastore/mysql/migrations/tables/20161118212528_CreateTableHosts.go +++ b/server/datastore/mysql/migrations/tables/20161118212528_CreateTableHosts.go @@ -12,39 +12,39 @@ func Up_20161118212528(tx *sql.Tx) error { _, err := tx.Exec( "CREATE TABLE `hosts` (" + "`id` int(10) unsigned NOT NULL AUTO_INCREMENT," + - "`osquery_host_id` varchar(255) NOT NULL," + + "`osquery_host_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL," + "`created_at` timestamp DEFAULT CURRENT_TIMESTAMP," + "`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," + "`deleted_at` timestamp NULL DEFAULT NULL," + "`deleted` tinyint(1) NOT NULL DEFAULT FALSE," + "`detail_update_time` timestamp NULL DEFAULT NULL," + - "`node_key` varchar(255) DEFAULT NULL," + - "`host_name` varchar(255) NOT NULL DEFAULT ''," + - "`uuid` varchar(255) NOT NULL DEFAULT ''," + - "`platform` varchar(255) NOT NULL DEFAULT ''," + - "`osquery_version` varchar(255) NOT NULL DEFAULT ''," + - "`os_version` varchar(255) NOT NULL DEFAULT ''," + - "`build` varchar(255) NOT NULL DEFAULT ''," + - "`platform_like` varchar(255) NOT NULL DEFAULT ''," + - "`code_name` varchar(255) NOT NULL DEFAULT ''," + + "`node_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL," + + "`host_name` 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(20) NOT NULL DEFAULT 0," + "`physical_memory` bigint(20) NOT NULL DEFAULT 0," + - "`cpu_type` varchar(255) NOT NULL DEFAULT ''," + - "`cpu_subtype` varchar(255) NOT NULL DEFAULT ''," + - "`cpu_brand` varchar(255) NOT NULL DEFAULT ''," + + "`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) NOT NULL DEFAULT ''," + - "`hardware_model` varchar(255) NOT NULL DEFAULT ''," + - "`hardware_version` varchar(255) NOT NULL DEFAULT ''," + - "`hardware_serial` varchar(255) NOT NULL DEFAULT ''," + - "`computer_name` varchar(255) NOT NULL DEFAULT ''," + + "`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(10) UNSIGNED DEFAULT NULL, " + "PRIMARY KEY (`id`)," + "UNIQUE KEY `idx_host_unique_nodekey` (`node_key`)," + "UNIQUE KEY `idx_osquery_host_id` (`osquery_host_id`)," + "FULLTEXT KEY `hosts_search` (`host_name`)" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8;", + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", ) return err } diff --git a/server/datastore/mysql/migrations/tables/20161118212538_CreateTableInvites.go b/server/datastore/mysql/migrations/tables/20161118212538_CreateTableInvites.go index f3fe5cac9f..81fb40683c 100644 --- a/server/datastore/mysql/migrations/tables/20161118212538_CreateTableInvites.go +++ b/server/datastore/mysql/migrations/tables/20161118212538_CreateTableInvites.go @@ -25,7 +25,7 @@ func Up_20161118212538(tx *sql.Tx) error { "PRIMARY KEY (`id`)," + "UNIQUE KEY `idx_invite_unique_email` (`email`)," + "UNIQUE KEY `idx_invite_unique_key` (`token`)" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8;", + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", ) return err } diff --git a/server/datastore/mysql/migrations/tables/20161118212557_CreateTableLabels.go b/server/datastore/mysql/migrations/tables/20161118212557_CreateTableLabels.go index 50712a1437..4c29068665 100644 --- a/server/datastore/mysql/migrations/tables/20161118212557_CreateTableLabels.go +++ b/server/datastore/mysql/migrations/tables/20161118212557_CreateTableLabels.go @@ -27,7 +27,7 @@ func Up_20161118212557(tx *sql.Tx) error { "PRIMARY KEY (`id`)," + "UNIQUE KEY `idx_label_unique_name` (`name`)," + "FULLTEXT KEY `labels_search` (`name`)" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8;", + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", ) return err } diff --git a/server/datastore/mysql/migrations/tables/20161118212613_CreateTableScheduledQueries.go b/server/datastore/mysql/migrations/tables/20161118212613_CreateTableScheduledQueries.go index 4a5b5637d0..ea7377d4ad 100644 --- a/server/datastore/mysql/migrations/tables/20161118212613_CreateTableScheduledQueries.go +++ b/server/datastore/mysql/migrations/tables/20161118212613_CreateTableScheduledQueries.go @@ -25,7 +25,7 @@ func Up_20161118212613(tx *sql.Tx) error { "`version` varchar(255) DEFAULT NULL," + "`shard` int(10) unsigned DEFAULT NULL," + "PRIMARY KEY (`id`)" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8;", + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", ) return err } diff --git a/server/datastore/mysql/migrations/tables/20161118212630_CreateTablePacks.go b/server/datastore/mysql/migrations/tables/20161118212630_CreateTablePacks.go index 5fca412327..c0ecb86b6e 100644 --- a/server/datastore/mysql/migrations/tables/20161118212630_CreateTablePacks.go +++ b/server/datastore/mysql/migrations/tables/20161118212630_CreateTablePacks.go @@ -23,7 +23,7 @@ func Up_20161118212630(tx *sql.Tx) error { "`created_by` int(10) unsigned DEFAULT NULL," + "PRIMARY KEY (`id`)," + "UNIQUE KEY `idx_pack_unique_name` (`name`)" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8;", + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", ) return err } diff --git a/server/datastore/mysql/migrations/tables/20161118212641_CreateTablePasswordResetRequests.go b/server/datastore/mysql/migrations/tables/20161118212641_CreateTablePasswordResetRequests.go index fc88041c1d..0fb1b67537 100644 --- a/server/datastore/mysql/migrations/tables/20161118212641_CreateTablePasswordResetRequests.go +++ b/server/datastore/mysql/migrations/tables/20161118212641_CreateTablePasswordResetRequests.go @@ -18,7 +18,7 @@ func Up_20161118212641(tx *sql.Tx) error { "`user_id` int(10) unsigned NOT NULL," + "`token` varchar(1024) NOT NULL," + "PRIMARY KEY (`id`)" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8;", + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", ) return err } diff --git a/server/datastore/mysql/migrations/tables/20161118212649_CreateTableUsers.go b/server/datastore/mysql/migrations/tables/20161118212649_CreateTableUsers.go index 95acc1bca6..b98ae4e66e 100644 --- a/server/datastore/mysql/migrations/tables/20161118212649_CreateTableUsers.go +++ b/server/datastore/mysql/migrations/tables/20161118212649_CreateTableUsers.go @@ -29,7 +29,7 @@ func Up_20161118212649(tx *sql.Tx) error { "PRIMARY KEY (`id`)," + "UNIQUE KEY `idx_user_unique_username` (`username`)," + "UNIQUE KEY `idx_user_unique_email` (`email`)" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8;", + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", ) return err } diff --git a/server/datastore/mysql/migrations/tables/20161118212656_CreateTableSessions.go b/server/datastore/mysql/migrations/tables/20161118212656_CreateTableSessions.go index 5d232d0f86..5a3dd50824 100644 --- a/server/datastore/mysql/migrations/tables/20161118212656_CreateTableSessions.go +++ b/server/datastore/mysql/migrations/tables/20161118212656_CreateTableSessions.go @@ -18,7 +18,7 @@ func Up_20161118212656(tx *sql.Tx) error { "`key` varchar(255) NOT NULL," + "PRIMARY KEY (`id`)," + "UNIQUE KEY `idx_session_unique_key` (`key`)" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8;", + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", ) return err } diff --git a/server/datastore/mysql/migrations/tables/20161118212758_CreateTableQueries.go b/server/datastore/mysql/migrations/tables/20161118212758_CreateTableQueries.go index 22fe175451..c5e4c465aa 100644 --- a/server/datastore/mysql/migrations/tables/20161118212758_CreateTableQueries.go +++ b/server/datastore/mysql/migrations/tables/20161118212758_CreateTableQueries.go @@ -23,7 +23,7 @@ func Up_20161118212758(tx *sql.Tx) error { "`author_id` int(10) unsigned DEFAULT NULL," + "PRIMARY KEY (`id`)," + "FOREIGN KEY (`author_id`) REFERENCES `users`(`id`) ON DELETE SET NULL" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8;", + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", ) return err } diff --git a/server/datastore/mysql/migrations/tables/20161128234849_CreateTableNetworkInterfaces.go b/server/datastore/mysql/migrations/tables/20161128234849_CreateTableNetworkInterfaces.go index 7199048c7a..c2ae731b5b 100644 --- a/server/datastore/mysql/migrations/tables/20161128234849_CreateTableNetworkInterfaces.go +++ b/server/datastore/mysql/migrations/tables/20161128234849_CreateTableNetworkInterfaces.go @@ -35,7 +35,7 @@ func Up_20161128234849(tx *sql.Tx) error { "ON DELETE CASCADE, " + "FULLTEXT KEY `ip_address_search` (`ip_address`)," + "UNIQUE KEY `idx_network_interfaces_unique_ip_host_intf` (`ip_address`, `host_id`, `interface`)" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8;", + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", ) return err } diff --git a/server/datastore/mysql/migrations/tables/20170124230432_CreateTableEmailChanges.go b/server/datastore/mysql/migrations/tables/20170124230432_CreateTableEmailChanges.go index 7ae64868a2..b9eef63c9b 100644 --- a/server/datastore/mysql/migrations/tables/20170124230432_CreateTableEmailChanges.go +++ b/server/datastore/mysql/migrations/tables/20170124230432_CreateTableEmailChanges.go @@ -16,7 +16,7 @@ func Up_20170124230432(tx *sql.Tx) error { "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=utf8;" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;" _, err := tx.Exec(sqlStatement) return err } diff --git a/server/datastore/mysql/migrations/tables/20170306075207_UseUTF8MB.go b/server/datastore/mysql/migrations/tables/20170306075207_UseUTF8MB.go index 73f6939baa..2a9a81e692 100644 --- a/server/datastore/mysql/migrations/tables/20170306075207_UseUTF8MB.go +++ b/server/datastore/mysql/migrations/tables/20170306075207_UseUTF8MB.go @@ -3,6 +3,7 @@ package tables import ( "database/sql" "fmt" + "os" "github.com/pkg/errors" ) @@ -14,6 +15,11 @@ func init() { // changeCharacterSet changes the default character set of the database and all // table to the provided character set func changeCharacterSet(tx *sql.Tx, charset string) error { + // This env var should only be set during TestCollation. + if v := os.Getenv("FLEET_TEST_DISABLE_COLLATION_UPDATES"); v != "" { + return nil + } + _, err := tx.Exec(fmt.Sprintf("ALTER DATABASE DEFAULT CHARACTER SET %s", charset)) if err != nil { return errors.Wrap(err, "alter database") @@ -45,7 +51,7 @@ func changeCharacterSet(tx *sql.Tx, charset string) error { rows.Close() for _, name := range names { - _, err = tx.Exec(fmt.Sprintf("ALTER TABLE %s CONVERT TO CHARACTER SET %s", name, charset)) + _, err = tx.Exec(fmt.Sprintf("ALTER TABLE %s CONVERT TO CHARACTER SET %s COLLATE utf8mb4_unicode_ci", name, charset)) if err != nil { return errors.Wrap(err, "alter table "+name) } diff --git a/server/datastore/mysql/migrations/tables/20171116163618_CreateTableOsqueryOptions.go b/server/datastore/mysql/migrations/tables/20171116163618_CreateTableOsqueryOptions.go index 1a2afca0d4..70531de874 100644 --- a/server/datastore/mysql/migrations/tables/20171116163618_CreateTableOsqueryOptions.go +++ b/server/datastore/mysql/migrations/tables/20171116163618_CreateTableOsqueryOptions.go @@ -21,7 +21,7 @@ func Up_20171116163618(tx *sql.Tx) error { "`override_identifier` VARCHAR(255) NOT NULL DEFAULT ''," + "`options` JSON NOT NULL," + "PRIMARY KEY (`id`)" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8;" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;" _, err := tx.Exec(sqlStatement) if err != nil { return errors.Wrap(err, "create table osquery_options") diff --git a/server/datastore/mysql/migrations/tables/20171219164727_UpdateScheduledQueryKey.go b/server/datastore/mysql/migrations/tables/20171219164727_UpdateScheduledQueryKey.go index 633c89b8ed..d7631580d8 100644 --- a/server/datastore/mysql/migrations/tables/20171219164727_UpdateScheduledQueryKey.go +++ b/server/datastore/mysql/migrations/tables/20171219164727_UpdateScheduledQueryKey.go @@ -60,8 +60,8 @@ func Up_20171219164727(tx *sql.Tx) error { query = ` ALTER TABLE scheduled_queries -ADD COLUMN name varchar(255), -ADD COLUMN description varchar(255) +ADD COLUMN name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, +ADD COLUMN description varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ` if _, err := tx.Exec(query); err != nil { return errors.Wrap(err, "adding name to scheduled_queries") diff --git a/server/datastore/mysql/migrations/tables/20200311140000_AddHostMacAndIp.go b/server/datastore/mysql/migrations/tables/20200311140000_AddHostMacAndIp.go index 25bd832b11..3a8a95b6fd 100644 --- a/server/datastore/mysql/migrations/tables/20200311140000_AddHostMacAndIp.go +++ b/server/datastore/mysql/migrations/tables/20200311140000_AddHostMacAndIp.go @@ -11,8 +11,8 @@ func init() { func Up20200311140000(tx *sql.Tx) error { _, err := tx.Exec( "ALTER TABLE `hosts` " + - "ADD COLUMN `primary_ip` varchar(45) NOT NULL DEFAULT ''," + - "ADD COLUMN `primary_mac` varchar(17) NOT NULL DEFAULT ''," + + "ADD COLUMN `primary_ip` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''," + + "ADD COLUMN `primary_mac` varchar(17) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''," + "ADD FULLTEXT KEY `host_ip_mac_search` (`primary_ip`,`primary_mac`)", ) return err diff --git a/server/datastore/mysql/migrations/tables/20200512120000_CreateTableEnrollSecrets.go b/server/datastore/mysql/migrations/tables/20200512120000_CreateTableEnrollSecrets.go index f6764a525a..365944bde9 100644 --- a/server/datastore/mysql/migrations/tables/20200512120000_CreateTableEnrollSecrets.go +++ b/server/datastore/mysql/migrations/tables/20200512120000_CreateTableEnrollSecrets.go @@ -18,7 +18,7 @@ func Up_20200512120000(tx *sql.Tx) error { "`secret` VARCHAR(255) NOT NULL," + "`active` TINYINT(1) DEFAULT TRUE," + "PRIMARY KEY (`name`)" + - ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;", + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", ) if err != nil { return errors.Wrap(err, "create enroll_secrets table") @@ -34,7 +34,7 @@ func Up_20200512120000(tx *sql.Tx) error { _, err = tx.Exec( "ALTER TABLE `hosts`" + - "ADD COLUMN `enroll_secret_name` VARCHAR(255) NOT NULL DEFAULT ''", + "ADD COLUMN `enroll_secret_name` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''", ) if err != nil { return errors.Wrap(err, "drop old secret column") diff --git a/server/datastore/mysql/migrations/tables/20201021104586_CreateCarveTables.go b/server/datastore/mysql/migrations/tables/20201021104586_CreateCarveTables.go index 2490613772..8e9ed43b84 100644 --- a/server/datastore/mysql/migrations/tables/20201021104586_CreateCarveTables.go +++ b/server/datastore/mysql/migrations/tables/20201021104586_CreateCarveTables.go @@ -27,7 +27,7 @@ func Up_20201021104586(tx *sql.Tx) error { UNIQUE KEY idx_session_id (session_id), UNIQUE KEY idx_name (name), FOREIGN KEY (host_id) REFERENCES hosts (id) ON DELETE CASCADE - )`); err != nil { + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;`); err != nil { return errors.Wrap(err, "create carve_metadata") } diff --git a/server/datastore/mysql/migrations/tables/20210421112652_AddSoftwareInventory.go b/server/datastore/mysql/migrations/tables/20210421112652_AddSoftwareInventory.go index 318acae696..8ffdc764dc 100644 --- a/server/datastore/mysql/migrations/tables/20210421112652_AddSoftwareInventory.go +++ b/server/datastore/mysql/migrations/tables/20210421112652_AddSoftwareInventory.go @@ -19,7 +19,7 @@ func Up_20210421112652(tx *sql.Tx) error { version varchar(255) NOT NULL DEFAULT '', source varchar(64) NOT NULL, UNIQUE KEY idx_name_version (name, version, source) - )`); err != nil { + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;`); err != nil { return errors.Wrap(err, "create table software") } diff --git a/server/datastore/mysql/migrations/tables/20210601000001_CreateTeamsTables.go b/server/datastore/mysql/migrations/tables/20210601000001_CreateTeamsTables.go index ac1a87c6ea..16aa9e6ade 100644 --- a/server/datastore/mysql/migrations/tables/20210601000001_CreateTeamsTables.go +++ b/server/datastore/mysql/migrations/tables/20210601000001_CreateTeamsTables.go @@ -17,7 +17,7 @@ func Up_20210601000001(tx *sql.Tx) error { name VARCHAR(255) NOT NULL, description VARCHAR(1023) NOT NULL DEFAULT '', UNIQUE KEY idx_name (name) - )`); err != nil { + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;`); err != nil { return errors.Wrap(err, "create teams") } @@ -29,7 +29,7 @@ func Up_20210601000001(tx *sql.Tx) error { PRIMARY KEY (user_id, team_id), FOREIGN KEY fk_user_teams_user_id (user_id) REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY fk_user_teams_team_id (team_id) REFERENCES teams (id) ON DELETE CASCADE ON UPDATE CASCADE - )`); err != nil { + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;`); err != nil { return errors.Wrap(err, "create user_teams") } @@ -41,7 +41,7 @@ func Up_20210601000001(tx *sql.Tx) error { } if _, err := tx.Exec(`ALTER TABLE users - ADD global_role VARCHAR(64) DEFAULT NULL + ADD global_role VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL `); err != nil { return errors.Wrap(err, "alter users") } diff --git a/server/datastore/mysql/migrations/tables/20210601000002_AddRolesToInvites.go b/server/datastore/mysql/migrations/tables/20210601000002_AddRolesToInvites.go index 602a26f6e4..8d02c7331c 100644 --- a/server/datastore/mysql/migrations/tables/20210601000002_AddRolesToInvites.go +++ b/server/datastore/mysql/migrations/tables/20210601000002_AddRolesToInvites.go @@ -19,7 +19,7 @@ func Up_20210601000002(tx *sql.Tx) error { PRIMARY KEY (invite_id, team_id), FOREIGN KEY fk_invite_id (invite_id) REFERENCES invites (id) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY fk_team_id (team_id) REFERENCES teams (id) ON DELETE CASCADE ON UPDATE CASCADE - )`); err != nil { + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;`); err != nil { return errors.Wrap(err, "create invite_teams") } diff --git a/server/datastore/mysql/migrations/tables/20210708143152_AddHostUsers.go b/server/datastore/mysql/migrations/tables/20210708143152_AddHostUsers.go index 22a2e9a6d4..16511677dc 100644 --- a/server/datastore/mysql/migrations/tables/20210708143152_AddHostUsers.go +++ b/server/datastore/mysql/migrations/tables/20210708143152_AddHostUsers.go @@ -21,7 +21,7 @@ func Up_20210708143152(tx *sql.Tx) error { user_type VARCHAR(255), UNIQUE KEY idx_uid_username (host_id, uid, username), FOREIGN KEY (host_id) REFERENCES hosts (id) ON DELETE CASCADE - )` + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;` if _, err := tx.Exec(sqlStatement); err != nil { return err } diff --git a/server/datastore/mysql/migrations/tables/20210709124443_CreateActivitiesTable.go b/server/datastore/mysql/migrations/tables/20210709124443_CreateActivitiesTable.go index 2a045c7457..798183da6e 100644 --- a/server/datastore/mysql/migrations/tables/20210709124443_CreateActivitiesTable.go +++ b/server/datastore/mysql/migrations/tables/20210709124443_CreateActivitiesTable.go @@ -2,6 +2,7 @@ package tables import ( "database/sql" + "github.com/pkg/errors" ) @@ -20,7 +21,7 @@ func Up_20210709124443(tx *sql.Tx) error { details json DEFAULT NULL, PRIMARY KEY (id), FOREIGN KEY fk_activities_user_id (user_id) REFERENCES users (id) ON DELETE SET NULL - ) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ` if _, err := tx.Exec(sql); err != nil { return errors.Wrap(err, "create activities") diff --git a/server/datastore/mysql/migrations/tables/20210712155608_CreateLocksTable.go b/server/datastore/mysql/migrations/tables/20210712155608_CreateLocksTable.go index 76c9802368..8e1e505334 100644 --- a/server/datastore/mysql/migrations/tables/20210712155608_CreateLocksTable.go +++ b/server/datastore/mysql/migrations/tables/20210712155608_CreateLocksTable.go @@ -2,6 +2,7 @@ package tables import ( "database/sql" + "github.com/pkg/errors" ) @@ -17,7 +18,7 @@ func Up_20210712155608(tx *sql.Tx) error { owner VARCHAR(255), expires_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY idx_name (name) - )`); err != nil { + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;`); err != nil { return errors.Wrap(err, "create locks") } return nil diff --git a/server/datastore/mysql/migrations/tables/20210719153709_AddStatisticsTable.go b/server/datastore/mysql/migrations/tables/20210719153709_AddStatisticsTable.go index eb2ff022ea..893b4d1ca1 100644 --- a/server/datastore/mysql/migrations/tables/20210719153709_AddStatisticsTable.go +++ b/server/datastore/mysql/migrations/tables/20210719153709_AddStatisticsTable.go @@ -18,7 +18,7 @@ func Up_20210719153709(tx *sql.Tx) error { updated_at timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, anonymous_identifier varchar(255) NOT NULL, PRIMARY KEY (id) - ) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ` if _, err := tx.Exec(sql); err != nil { return errors.Wrap(err, "create statistics") diff --git a/server/datastore/mysql/migrations/tables/20210721171531_AddCPETable.go b/server/datastore/mysql/migrations/tables/20210721171531_AddCPETable.go index b05cc245ab..48468f93fc 100644 --- a/server/datastore/mysql/migrations/tables/20210721171531_AddCPETable.go +++ b/server/datastore/mysql/migrations/tables/20210721171531_AddCPETable.go @@ -20,7 +20,7 @@ func Up_20210721171531(tx *sql.Tx) error { cpe varchar(255) NOT NULL, PRIMARY KEY (id), FOREIGN KEY fk_software_cpe_software_id (software_id) REFERENCES software(id) ON DELETE CASCADE - ) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ` if _, err := tx.Exec(sql); err != nil { return errors.Wrap(err, "create cpe") diff --git a/server/datastore/mysql/migrations/tables/20210802135933_AddCVETable.go b/server/datastore/mysql/migrations/tables/20210802135933_AddCVETable.go index c23ad74e69..98d1ef1cd2 100644 --- a/server/datastore/mysql/migrations/tables/20210802135933_AddCVETable.go +++ b/server/datastore/mysql/migrations/tables/20210802135933_AddCVETable.go @@ -21,7 +21,7 @@ func Up_20210802135933(tx *sql.Tx) error { PRIMARY KEY (id), FOREIGN KEY fk_software_cve_cpe_id (cpe_id) REFERENCES software_cpe(id) ON DELETE CASCADE, UNIQUE KEY unique_cpe_cve(cpe_id, cve) - ) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ` if _, err := tx.Exec(sql); err != nil { return errors.Wrap(err, "create cve") diff --git a/server/datastore/mysql/migrations/tables/20210819143446_AddPolicies.go b/server/datastore/mysql/migrations/tables/20210819143446_AddPolicies.go index af2efdc9df..4405371827 100644 --- a/server/datastore/mysql/migrations/tables/20210819143446_AddPolicies.go +++ b/server/datastore/mysql/migrations/tables/20210819143446_AddPolicies.go @@ -19,7 +19,7 @@ func Up_20210819143446(tx *sql.Tx) error { updated_at timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id), FOREIGN KEY fk_policies_query_id (query_id) REFERENCES queries(id) ON DELETE RESTRICT - ); + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ` policyMembershipHistoryTable := ` CREATE TABLE IF NOT EXISTS policy_membership_history ( diff --git a/server/datastore/mysql/migrations/tables/20211013133707_AddAggregatedStats.go b/server/datastore/mysql/migrations/tables/20211013133707_AddAggregatedStats.go index bb0ad1c2bf..595e570af4 100644 --- a/server/datastore/mysql/migrations/tables/20211013133707_AddAggregatedStats.go +++ b/server/datastore/mysql/migrations/tables/20211013133707_AddAggregatedStats.go @@ -20,7 +20,7 @@ func Up_20211013133707(tx *sql.Tx) error { updated_at timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id, type), INDEX idx_aggregated_stats_updated_at(updated_at) - ); + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ` if _, err := tx.Exec(aggregatedStatsTable); err != nil { return errors.Wrap(err, "create aggregated stats table") diff --git a/server/datastore/mysql/migrations/tables/20211216131203_AddMDMMunkiTables.go b/server/datastore/mysql/migrations/tables/20211216131203_AddMDMMunkiTables.go index 1e2d09860c..27a1552e86 100644 --- a/server/datastore/mysql/migrations/tables/20211216131203_AddMDMMunkiTables.go +++ b/server/datastore/mysql/migrations/tables/20211216131203_AddMDMMunkiTables.go @@ -18,7 +18,7 @@ func Up_20211216131203(tx *sql.Tx) error { server_url VARCHAR(255) DEFAULT '' NOT NULL, installed_from_dep bool DEFAULT FALSE NOT NULL, PRIMARY KEY (host_id) - ); + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ` if _, err := tx.Exec(mdmTable); err != nil { return errors.Wrap(err, "create host_mdm table") @@ -28,7 +28,7 @@ func Up_20211216131203(tx *sql.Tx) error { host_id int(10) UNSIGNED NOT NULL, version VARCHAR(255) DEFAULT '' NOT NULL, PRIMARY KEY (host_id) - ); + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ` if _, err := tx.Exec(munkiInfoTable); err != nil { return errors.Wrap(err, "create host_munki_info table") diff --git a/server/datastore/mysql/migrations/tables/20211221110132_AddHostEmailsTable.go b/server/datastore/mysql/migrations/tables/20211221110132_AddHostEmailsTable.go index 50b0669f0f..a61aae7af7 100644 --- a/server/datastore/mysql/migrations/tables/20211221110132_AddHostEmailsTable.go +++ b/server/datastore/mysql/migrations/tables/20211221110132_AddHostEmailsTable.go @@ -23,7 +23,7 @@ func Up_20211221110132(tx *sql.Tx) error { PRIMARY KEY (id), INDEX idx_host_emails_host_id_email (host_id, email), INDEX idx_host_emails_email (email) - ); + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ` if _, err := tx.Exec(hostEmailsTable); err != nil { return errors.Wrap(err, "create host_emails table") diff --git a/server/datastore/mysql/migrations/tables/20220307104655_AddHostDeviceAuth.go b/server/datastore/mysql/migrations/tables/20220307104655_AddHostDeviceAuth.go index 9af2b648ba..606250ab54 100644 --- a/server/datastore/mysql/migrations/tables/20220307104655_AddHostDeviceAuth.go +++ b/server/datastore/mysql/migrations/tables/20220307104655_AddHostDeviceAuth.go @@ -17,7 +17,7 @@ func Up_20220307104655(tx *sql.Tx) error { token VARCHAR(255) NOT NULL, PRIMARY KEY (host_id), UNIQUE INDEX idx_host_device_auth_token (token) - ); + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ` if _, err := tx.Exec(hostDeviceAuthTable); err != nil { return errors.Wrap(err, "create host_device_auth table") diff --git a/server/datastore/mysql/migrations/tables/20220316155700_AddPublicIPHosts.go b/server/datastore/mysql/migrations/tables/20220316155700_AddPublicIPHosts.go index d88561479c..3ef1f02bc0 100644 --- a/server/datastore/mysql/migrations/tables/20220316155700_AddPublicIPHosts.go +++ b/server/datastore/mysql/migrations/tables/20220316155700_AddPublicIPHosts.go @@ -12,7 +12,7 @@ func init() { func Up_20220316155700(tx *sql.Tx) error { _, err := tx.Exec( - "ALTER TABLE `hosts` ADD COLUMN `public_ip` varchar(45) NOT NULL DEFAULT ''", + "ALTER TABLE `hosts` ADD COLUMN `public_ip` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''", ) if err != nil { return errors.Wrap(err, "add public_ip column") @@ -20,6 +20,7 @@ func Up_20220316155700(tx *sql.Tx) error { return nil } + func Down_20220316155700(tx *sql.Tx) error { return nil } diff --git a/server/datastore/mysql/migrations/tables/20220330100659_AddJobsTable.go b/server/datastore/mysql/migrations/tables/20220330100659_AddJobsTable.go index 7ad8f59d9a..e9a8a79e85 100644 --- a/server/datastore/mysql/migrations/tables/20220330100659_AddJobsTable.go +++ b/server/datastore/mysql/migrations/tables/20220330100659_AddJobsTable.go @@ -21,7 +21,7 @@ CREATE TABLE jobs ( state VARCHAR(255) NOT NULL, retries INT NOT NULL DEFAULT 0, error TEXT -) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; `) if err != nil { return errors.Wrapf(err, "create table") diff --git a/server/datastore/mysql/migrations/tables/20220503134048_AddCVEScoresTable.go b/server/datastore/mysql/migrations/tables/20220503134048_AddCVEScoresTable.go index f8e976ff85..d33ebce26e 100644 --- a/server/datastore/mysql/migrations/tables/20220503134048_AddCVEScoresTable.go +++ b/server/datastore/mysql/migrations/tables/20220503134048_AddCVEScoresTable.go @@ -17,7 +17,7 @@ CREATE TABLE cve_scores ( cvss_score double, epss_probability double, cisa_known_exploit boolean -) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; `) if err != nil { return errors.Wrapf(err, "create table") diff --git a/server/datastore/mysql/migrations/tables/20220627104817_AddHostBatteriesTable.go b/server/datastore/mysql/migrations/tables/20220627104817_AddHostBatteriesTable.go index 5f258d561d..50a069bfcb 100644 --- a/server/datastore/mysql/migrations/tables/20220627104817_AddHostBatteriesTable.go +++ b/server/datastore/mysql/migrations/tables/20220627104817_AddHostBatteriesTable.go @@ -24,7 +24,7 @@ CREATE TABLE host_batteries ( updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, UNIQUE KEY idx_host_batteries_host_id_serial_number (host_id, serial_number) -)`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;`) if err != nil { return errors.Wrapf(err, "create table") } diff --git a/server/datastore/mysql/migrations/tables/20220713091130_AddOperatingSystemsTable.go b/server/datastore/mysql/migrations/tables/20220713091130_AddOperatingSystemsTable.go index 4b5992b384..4500c119e4 100644 --- a/server/datastore/mysql/migrations/tables/20220713091130_AddOperatingSystemsTable.go +++ b/server/datastore/mysql/migrations/tables/20220713091130_AddOperatingSystemsTable.go @@ -21,7 +21,7 @@ CREATE TABLE operating_systems ( kernel_version VARCHAR(150) NOT NULL, platform VARCHAR(50) NOT NULL, UNIQUE KEY idx_unique_os (name, version, arch, kernel_version, platform) -) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; `) if err != nil { return errors.Wrapf(err, "create operating_systems table") diff --git a/server/datastore/mysql/migrations/tables/20220802135510_AddMobileDeviceManagementTable.go b/server/datastore/mysql/migrations/tables/20220802135510_AddMobileDeviceManagementTable.go index 41b566aeec..f609dd00e3 100644 --- a/server/datastore/mysql/migrations/tables/20220802135510_AddMobileDeviceManagementTable.go +++ b/server/datastore/mysql/migrations/tables/20220802135510_AddMobileDeviceManagementTable.go @@ -22,7 +22,7 @@ CREATE TABLE mobile_device_management_solutions ( updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, UNIQUE KEY idx_mobile_device_management_solutions_name (name, server_url) -)`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;`) if err != nil { return errors.Wrapf(err, "create table") } diff --git a/server/datastore/mysql/migrations/tables/20220822161445_CreateMunkiIssuesTable.go b/server/datastore/mysql/migrations/tables/20220822161445_CreateMunkiIssuesTable.go index dd9f017b7a..22c5ef7ac7 100644 --- a/server/datastore/mysql/migrations/tables/20220822161445_CreateMunkiIssuesTable.go +++ b/server/datastore/mysql/migrations/tables/20220822161445_CreateMunkiIssuesTable.go @@ -28,7 +28,7 @@ func Up_20220822161445(tx *sql.Tx) error { created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY idx_munki_issues_name (name, issue_type) - )`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;`) if err != nil { return errors.Wrapf(err, "create munki_issues table") } diff --git a/server/datastore/mysql/migrations/tables/20220908181826_AddOrbitNodeKeyToHosts_test.go b/server/datastore/mysql/migrations/tables/20220908181826_AddOrbitNodeKeyToHosts_test.go index 1f0ba2bde0..9ba44293e6 100644 --- a/server/datastore/mysql/migrations/tables/20220908181826_AddOrbitNodeKeyToHosts_test.go +++ b/server/datastore/mysql/migrations/tables/20220908181826_AddOrbitNodeKeyToHosts_test.go @@ -26,8 +26,8 @@ func TestUp_20220908181826(t *testing.T) { require.NoError(t, err) applyNext(t, db) + sqlUpdate := `UPDATE hosts SET orbit_node_key = ? WHERE osquery_host_id = ?` _, err = db.Exec(sqlUpdate, "orbit_node_key", "host_id") require.NoError(t, err) - } diff --git a/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables.go b/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables.go index cc8ecaedda..89c2a299fe 100644 --- a/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables.go +++ b/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables.go @@ -52,7 +52,7 @@ CREATE TABLE IF NOT EXISTS mdm_apple_enrollment_profiles ( PRIMARY KEY (id), UNIQUE KEY idx_token (token), UNIQUE KEY idx_type (type) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; `) if err != nil { return fmt.Errorf("failed to create mdm_apple_enrollments table: %w", err) @@ -68,7 +68,7 @@ CREATE TABLE IF NOT EXISTS mdm_apple_installers ( url_token VARCHAR(36) DEFAULT NULL, PRIMARY KEY (id) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; `) if err != nil { return fmt.Errorf("failed to create mdm_apple_installers table: %w", err) diff --git a/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables_nanodep.sql b/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables_nanodep.sql index a74907ddc3..b22cee1b0b 100644 --- a/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables_nanodep.sql +++ b/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables_nanodep.sql @@ -33,4 +33,4 @@ CREATE TABLE nano_dep_names ( CHECK (tokenpki_cert_pem IS NULL OR SUBSTRING(tokenpki_cert_pem FROM 1 FOR 27) = '-----BEGIN CERTIFICATE-----'), CHECK (tokenpki_key_pem IS NULL OR SUBSTRING(tokenpki_key_pem FROM 1 FOR 5) = '-----') -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables_nanomdm.sql b/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables_nanomdm.sql index d446aa5e7d..5ac3a90043 100644 --- a/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables_nanomdm.sql +++ b/server/datastore/mysql/migrations/tables/20220915165115_AppleMDMTables_nanomdm.sql @@ -3,7 +3,7 @@ */ CREATE TABLE nano_devices ( - id VARCHAR(255) NOT NULL, + id VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, identity_cert TEXT NULL, @@ -41,7 +41,7 @@ CREATE TABLE nano_devices ( CHECK (token_update IS NULL OR token_update != ''), CHECK (bootstrap_token_b64 IS NULL OR bootstrap_token_b64 != '') -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE nano_users ( @@ -77,7 +77,7 @@ CREATE TABLE nano_users ( CHECK (user_authenticate IS NULL OR user_authenticate != ''), CHECK (user_authenticate_digest IS NULL OR user_authenticate_digest != '') -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ALTER TABLE nano_users ADD CONSTRAINT idx_unique_id UNIQUE (id); @@ -86,7 +86,7 @@ ALTER TABLE nano_users ADD CONSTRAINT idx_unique_id UNIQUE (id); */ CREATE TABLE nano_enrollments ( -- The enrollment ID of this enrollment - id VARCHAR(255) NOT NULL, + id VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, -- The "device" enrollment ID of this enrollment. This will be -- the same as the `id` field in the case of a "device" enrollment, -- or will be the "parent" enrollment for a "user" enrollment. @@ -130,7 +130,7 @@ CREATE TABLE nano_enrollments ( CHECK (topic != ''), CHECK (push_magic != ''), CHECK (token_hex != '') -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /* Commands stand alone. By themsevles they aren't associated with @@ -151,7 +151,7 @@ CREATE TABLE nano_commands ( CHECK (command_uuid != ''), CHECK (request_type != ''), CHECK (SUBSTRING(command FROM 1 FOR 5) = ' 1 COLLATE %s`, collation, collation, collation, collation, collation)) - if err != nil { return fmt.Errorf("aggregating dupes: %w", err) } @@ -208,6 +208,11 @@ func fixupOS(tx *sql.Tx, collation string) error { // This is based on the changeCharacterSet function that's included in this // module and part of the 20170306075207_UseUTF8MB migration. func changeCollation(tx *sql.Tx, charset string, collation string) (err error) { + // This env var should only be set during TestCollation. + if v := os.Getenv("FLEET_TEST_DISABLE_COLLATION_UPDATES"); v != "" { + return nil + } + _, err = tx.Exec(fmt.Sprintf("ALTER DATABASE DEFAULT CHARACTER SET `%s` COLLATE `%s`", charset, collation)) if err != nil { return fmt.Errorf("alter database: %w", err) @@ -228,11 +233,11 @@ func changeCollation(tx *sql.Tx, charset string, collation string) (err error) { txx := sqlx.Tx{Tx: tx} var names []string err = txx.Select(&names, ` - SELECT table_name - FROM information_schema.TABLES AS T, information_schema.COLLATION_CHARACTER_SET_APPLICABILITY AS C - WHERE C.collation_name = T.table_collation - AND T.table_schema = (SELECT database()) - AND (C.CHARACTER_SET_NAME != ? OR C.COLLATION_NAME != ?) + SELECT table_name + FROM information_schema.TABLES AS T, information_schema.COLLATION_CHARACTER_SET_APPLICABILITY AS C + WHERE C.collation_name = T.table_collation + AND T.table_schema = (SELECT database()) + AND (C.CHARACTER_SET_NAME != ? OR C.COLLATION_NAME != ?) -- exclude tables that have columns with specific collations AND table_name NOT IN ('hosts', 'enroll_secrets')`, charset, collation) if err != nil { diff --git a/server/datastore/mysql/migrations/tables/20230411102858_CreateHostBootstrapPackagesTable.go b/server/datastore/mysql/migrations/tables/20230411102858_CreateHostBootstrapPackagesTable.go index 0a12e63fb0..7f7440e76b 100644 --- a/server/datastore/mysql/migrations/tables/20230411102858_CreateHostBootstrapPackagesTable.go +++ b/server/datastore/mysql/migrations/tables/20230411102858_CreateHostBootstrapPackagesTable.go @@ -13,8 +13,8 @@ func Up_20230411102858(tx *sql.Tx) error { // create host_mdm_apple_bootstrap_packages table _, err := tx.Exec(` CREATE TABLE host_mdm_apple_bootstrap_packages ( - host_uuid varchar(127) NOT NULL, - command_uuid varchar(127) NOT NULL, + host_uuid varchar(127) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + command_uuid varchar(127) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (host_uuid), FOREIGN KEY (command_uuid) REFERENCES nano_commands (command_uuid) ON DELETE CASCADE diff --git a/server/datastore/mysql/migrations/tables/20230518114155_AddFullnameToMDMIdPAccountsTable.go b/server/datastore/mysql/migrations/tables/20230518114155_AddFullnameToMDMIdPAccountsTable.go index 7499fdb9e0..5ee425e92a 100644 --- a/server/datastore/mysql/migrations/tables/20230518114155_AddFullnameToMDMIdPAccountsTable.go +++ b/server/datastore/mysql/migrations/tables/20230518114155_AddFullnameToMDMIdPAccountsTable.go @@ -15,7 +15,7 @@ func Up_20230518114155(tx *sql.Tx) error { DROP COLUMN salt, DROP COLUMN entropy, DROP COLUMN iterations, - ADD COLUMN fullname varchar(256) NOT NULL DEFAULT '' + ADD COLUMN fullname varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' ` if _, err := tx.Exec(stmt); err != nil { return fmt.Errorf("alter mdm_idp_accounts table: %w", err) diff --git a/server/datastore/mysql/migrations/tables/20230721135421_QueriesSchemaChanges.go b/server/datastore/mysql/migrations/tables/20230721135421_QueriesSchemaChanges.go index 5202b562bb..4af6cd248b 100644 --- a/server/datastore/mysql/migrations/tables/20230721135421_QueriesSchemaChanges.go +++ b/server/datastore/mysql/migrations/tables/20230721135421_QueriesSchemaChanges.go @@ -29,12 +29,12 @@ func Up_20230721135421(tx *sql.Tx) error { ADD team_id INT(10) UNSIGNED DEFAULT NULL, ADD team_id_char CHAR(10) DEFAULT '' NOT NULL, - ADD platform VARCHAR(255) DEFAULT '' NOT NULL, - ADD min_osquery_version VARCHAR(255) DEFAULT '' NOT NULL, + ADD platform VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' NOT NULL, + ADD min_osquery_version VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' NOT NULL, ADD schedule_interval INT(10) UNSIGNED DEFAULT 0 NOT NULL, ADD automations_enabled TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, - ADD logging_type VARCHAR(255) DEFAULT 'snapshot' NOT NULL, + ADD logging_type VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'snapshot' NOT NULL, ADD FOREIGN KEY fk_queries_team_id (team_id) REFERENCES teams (id) ON DELETE CASCADE, ADD UNIQUE INDEX idx_team_id_name_unq (team_id_char, name); diff --git a/server/datastore/mysql/migrations/tables/20250127162751_AddUnifiedQueueTable.go b/server/datastore/mysql/migrations/tables/20250127162751_AddUnifiedQueueTable.go index 7eebc0a041..7055c9e07f 100644 --- a/server/datastore/mysql/migrations/tables/20250127162751_AddUnifiedQueueTable.go +++ b/server/datastore/mysql/migrations/tables/20250127162751_AddUnifiedQueueTable.go @@ -3,6 +3,7 @@ package tables import ( "database/sql" "fmt" + "os" "github.com/jmoiron/sqlx" ) @@ -17,6 +18,11 @@ func init() { // This is based on the changeCollation function that's included in this // module and part of the 20230315104937_EnsureUniformCollation migration. func changeCollation2025(tx *sql.Tx, charset string, collation string) (err error) { + // This env var should only be set during TestCollation. + if v := os.Getenv("FLEET_TEST_DISABLE_COLLATION_UPDATES"); v != "" { + return nil + } + _, err = tx.Exec(fmt.Sprintf("ALTER DATABASE DEFAULT CHARACTER SET `%s` COLLATE `%s`", charset, collation)) if err != nil { return fmt.Errorf("alter database: %w", err) @@ -25,11 +31,11 @@ func changeCollation2025(tx *sql.Tx, charset string, collation string) (err erro txx := sqlx.Tx{Tx: tx} var names []string err = txx.Select(&names, ` - SELECT table_name - FROM information_schema.TABLES AS T, information_schema.COLLATION_CHARACTER_SET_APPLICABILITY AS C - WHERE C.collation_name = T.table_collation - AND T.table_schema = (SELECT database()) - AND (C.CHARACTER_SET_NAME != ? OR C.COLLATION_NAME != ?) + SELECT table_name + FROM information_schema.TABLES AS T, information_schema.COLLATION_CHARACTER_SET_APPLICABILITY AS C + WHERE C.collation_name = T.table_collation + AND T.table_schema = (SELECT database()) + AND (C.CHARACTER_SET_NAME != ? OR C.COLLATION_NAME != ?) -- exclude tables that have columns with specific collations AND table_name NOT IN ('hosts', 'enroll_secrets')`, charset, collation) if err != nil { diff --git a/server/datastore/mysql/migrations/tables/20250501162727_AddSoftwareCategories.go b/server/datastore/mysql/migrations/tables/20250501162727_AddSoftwareCategories.go index 3946c6b5db..5ef34e8e99 100644 --- a/server/datastore/mysql/migrations/tables/20250501162727_AddSoftwareCategories.go +++ b/server/datastore/mysql/migrations/tables/20250501162727_AddSoftwareCategories.go @@ -12,9 +12,9 @@ func init() { func Up_20250501162727(tx *sql.Tx) error { _, err := tx.Exec(`CREATE TABLE IF NOT EXISTS software_categories ( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + name VARCHAR(63) NOT NULL, UNIQUE KEY idx_software_categories_name (name) - )`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;`) if err != nil { return fmt.Errorf("failed to create software_categories table: %w", err) } diff --git a/server/datastore/mysql/migrations/tables/20250529102706_SetMediumTextColumns.go b/server/datastore/mysql/migrations/tables/20250529102706_SetMediumTextColumns.go new file mode 100644 index 0000000000..b5a938bc88 --- /dev/null +++ b/server/datastore/mysql/migrations/tables/20250529102706_SetMediumTextColumns.go @@ -0,0 +1,33 @@ +package tables + +import ( + "database/sql" + "fmt" +) + +func init() { + MigrationClient.AddMigration(Up_20250529102706, Down_20250529102706) +} + +func Up_20250529102706(tx *sql.Tx) error { + _, err := tx.Exec( + `ALTER TABLE queries + MODIFY query MEDIUMTEXT NOT NULL, + MODIFY description MEDIUMTEXT NOT NULL; +`, + ) + if err != nil { + return fmt.Errorf("failed to set queries.query and queries.description to mediumtext: %w", err) + } + _, err = tx.Exec( + `ALTER TABLE labels MODIFY query MEDIUMTEXT NOT NULL;`, + ) + if err != nil { + return fmt.Errorf("failed to set labels.query to mediumtext: %w", err) + } + return nil +} + +func Down_20250529102706(tx *sql.Tx) error { + return nil +} diff --git a/server/datastore/mysql/migrations/tables/collation_test.go b/server/datastore/mysql/migrations/tables/collation_test.go new file mode 100644 index 0000000000..b168f3a58b --- /dev/null +++ b/server/datastore/mysql/migrations/tables/collation_test.go @@ -0,0 +1,31 @@ +package tables + +import ( + "errors" + "os" + "testing" + + "github.com/fleetdm/fleet/v4/server/goose" + "github.com/stretchr/testify/require" +) + +func TestCollation(t *testing.T) { + require.NoError(t, os.Setenv("FLEET_TEST_DISABLE_COLLATION_UPDATES", "true")) + t.Cleanup(func() { + require.NoError(t, os.Unsetenv("FLEET_TEST_DISABLE_COLLATION_UPDATES")) + }) + + db := newDBConnForTests(t) + for { + current, err := MigrationClient.GetDBVersion(db.DB) + require.NoError(t, err) + _, err = MigrationClient.Migrations.Next(current) + if errors.Is(err, goose.ErrNoNextVersion) { + break + } + require.NoError(t, err) + applyNext(t, db) + } + + checkCollation(t, db) +} diff --git a/server/datastore/mysql/migrations/tables/migration_test.go b/server/datastore/mysql/migrations/tables/migration_test.go index 50dfc22aa2..159635a36a 100644 --- a/server/datastore/mysql/migrations/tables/migration_test.go +++ b/server/datastore/mysql/migrations/tables/migration_test.go @@ -155,6 +155,36 @@ func insertQuery(t *testing.T, db *sqlx.DB) uint { return uint(id) //nolint:gosec // dismiss G115 } +func checkCollation(t *testing.T, db *sqlx.DB) { + type collationData struct { + CollationName string `db:"COLLATION_NAME"` + TableName string `db:"TABLE_NAME"` + ColumnName string `db:"COLUMN_NAME"` + CharacterSetName string `db:"CHARACTER_SET_NAME"` + } + + stmt := ` +SELECT + TABLE_NAME, COLLATION_NAME, COLUMN_NAME, CHARACTER_SET_NAME +FROM information_schema.columns +WHERE + TABLE_SCHEMA = (SELECT DATABASE()) + AND (CHARACTER_SET_NAME != ? OR COLLATION_NAME != ?)` + + var nonStandardCollations []collationData + err := db.Select(&nonStandardCollations, stmt, "utf8mb4", "utf8mb4_unicode_ci") + require.NoError(t, err) + + exceptions := []collationData{ + {"utf8mb4_bin", "enroll_secrets", "secret", "utf8mb4"}, + {"utf8mb4_bin", "hosts", "node_key", "utf8mb4"}, + {"utf8mb4_bin", "hosts", "orbit_node_key", "utf8mb4"}, + {"utf8mb4_bin", "teams", "name_bin", "utf8mb4"}, + } + + require.ElementsMatch(t, exceptions, nonStandardCollations) +} + func insertHost(t *testing.T, db *sqlx.DB, teamID *uint) uint { // Insert a minimal record into hosts table insertHostStmt := ` diff --git a/server/datastore/mysql/schema.sql b/server/datastore/mysql/schema.sql index e8a8e5e369..fad68207fb 100644 --- a/server/datastore/mysql/schema.sql +++ b/server/datastore/mysql/schema.sql @@ -331,7 +331,7 @@ CREATE TABLE `host_batteries` ( `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`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -458,7 +458,7 @@ CREATE TABLE `host_display_names` ( `display_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`host_id`), KEY `display_name` (`display_name`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -472,7 +472,7 @@ CREATE TABLE `host_emails` ( PRIMARY KEY (`id`), KEY `idx_host_emails_host_id_email` (`host_id`,`email`), KEY `idx_host_emails_email` (`email`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -528,8 +528,8 @@ CREATE TABLE `host_mdm_apple_awaiting_configuration` ( /*!40101 SET @saved_cs_client = @@character_set_client */; /*!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, + `host_uuid` varchar(127) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `command_uuid` varchar(127) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`host_uuid`), KEY `command_uuid` (`command_uuid`), CONSTRAINT `host_mdm_apple_bootstrap_packages_ibfk_1` FOREIGN KEY (`command_uuid`) REFERENCES `nano_commands` (`command_uuid`) ON DELETE CASCADE @@ -565,7 +565,7 @@ CREATE TABLE `host_mdm_apple_profiles` ( `operation_type` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `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 '', + `profile_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `checksum` binary(16) NOT NULL, `retries` tinyint unsigned NOT NULL DEFAULT '0', `profile_uuid` varchar(37) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', @@ -917,7 +917,7 @@ CREATE TABLE `invite_teams` ( 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 -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -1020,7 +1020,7 @@ CREATE TABLE `locks` ( `expires_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `idx_name` (`name`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -1128,7 +1128,7 @@ CREATE TABLE `mdm_apple_enrollment_profiles` ( PRIMARY KEY (`id`), UNIQUE KEY `idx_type` (`type`), UNIQUE KEY `idx_token` (`token`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -1140,7 +1140,7 @@ CREATE TABLE `mdm_apple_installers` ( `installer` longblob, `url_token` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -1251,7 +1251,7 @@ CREATE TABLE `mdm_declaration_labels` ( CREATE TABLE `mdm_delivery_status` ( `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`status`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -1259,7 +1259,7 @@ INSERT INTO `mdm_delivery_status` VALUES ('failed'),('pending'),('verified'),('v 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 '', + `fullname` varchar(256) CHARACTER SET utf8mb4 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, @@ -1272,7 +1272,7 @@ CREATE TABLE `mdm_idp_accounts` ( CREATE TABLE `mdm_operation_types` ( `operation_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`operation_type`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -1323,9 +1323,9 @@ CREATE TABLE `migration_status_tables` ( `is_applied` tinyint(1) NOT NULL, `tstamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=390 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=391 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO `migration_status_tables` VALUES (1,0,1,'2020-01-01 01:01:01'),(2,20161118193812,1,'2020-01-01 01:01:01'),(3,20161118211713,1,'2020-01-01 01:01:01'),(4,20161118212436,1,'2020-01-01 01:01:01'),(5,20161118212515,1,'2020-01-01 01:01:01'),(6,20161118212528,1,'2020-01-01 01:01:01'),(7,20161118212538,1,'2020-01-01 01:01:01'),(8,20161118212549,1,'2020-01-01 01:01:01'),(9,20161118212557,1,'2020-01-01 01:01:01'),(10,20161118212604,1,'2020-01-01 01:01:01'),(11,20161118212613,1,'2020-01-01 01:01:01'),(12,20161118212621,1,'2020-01-01 01:01:01'),(13,20161118212630,1,'2020-01-01 01:01:01'),(14,20161118212641,1,'2020-01-01 01:01:01'),(15,20161118212649,1,'2020-01-01 01:01:01'),(16,20161118212656,1,'2020-01-01 01:01:01'),(17,20161118212758,1,'2020-01-01 01:01:01'),(18,20161128234849,1,'2020-01-01 01:01:01'),(19,20161230162221,1,'2020-01-01 01:01:01'),(20,20170104113816,1,'2020-01-01 01:01:01'),(21,20170105151732,1,'2020-01-01 01:01:01'),(22,20170108191242,1,'2020-01-01 01:01:01'),(23,20170109094020,1,'2020-01-01 01:01:01'),(24,20170109130438,1,'2020-01-01 01:01:01'),(25,20170110202752,1,'2020-01-01 01:01:01'),(26,20170111133013,1,'2020-01-01 01:01:01'),(27,20170117025759,1,'2020-01-01 01:01:01'),(28,20170118191001,1,'2020-01-01 01:01:01'),(29,20170119234632,1,'2020-01-01 01:01:01'),(30,20170124230432,1,'2020-01-01 01:01:01'),(31,20170127014618,1,'2020-01-01 01:01:01'),(32,20170131232841,1,'2020-01-01 01:01:01'),(33,20170223094154,1,'2020-01-01 01:01:01'),(34,20170306075207,1,'2020-01-01 01:01:01'),(35,20170309100733,1,'2020-01-01 01:01:01'),(36,20170331111922,1,'2020-01-01 01:01:01'),(37,20170502143928,1,'2020-01-01 01:01:01'),(38,20170504130602,1,'2020-01-01 01:01:01'),(39,20170509132100,1,'2020-01-01 01:01:01'),(40,20170519105647,1,'2020-01-01 01:01:01'),(41,20170519105648,1,'2020-01-01 01:01:01'),(42,20170831234300,1,'2020-01-01 01:01:01'),(43,20170831234301,1,'2020-01-01 01:01:01'),(44,20170831234303,1,'2020-01-01 01:01:01'),(45,20171116163618,1,'2020-01-01 01:01:01'),(46,20171219164727,1,'2020-01-01 01:01:01'),(47,20180620164811,1,'2020-01-01 01:01:01'),(48,20180620175054,1,'2020-01-01 01:01:01'),(49,20180620175055,1,'2020-01-01 01:01:01'),(50,20191010101639,1,'2020-01-01 01:01:01'),(51,20191010155147,1,'2020-01-01 01:01:01'),(52,20191220130734,1,'2020-01-01 01:01:01'),(53,20200311140000,1,'2020-01-01 01:01:01'),(54,20200405120000,1,'2020-01-01 01:01:01'),(55,20200407120000,1,'2020-01-01 01:01:01'),(56,20200420120000,1,'2020-01-01 01:01:01'),(57,20200504120000,1,'2020-01-01 01:01:01'),(58,20200512120000,1,'2020-01-01 01:01:01'),(59,20200707120000,1,'2020-01-01 01:01:01'),(60,20201011162341,1,'2020-01-01 01:01:01'),(61,20201021104586,1,'2020-01-01 01:01:01'),(62,20201102112520,1,'2020-01-01 01:01:01'),(63,20201208121729,1,'2020-01-01 01:01:01'),(64,20201215091637,1,'2020-01-01 01:01:01'),(65,20210119174155,1,'2020-01-01 01:01:01'),(66,20210326182902,1,'2020-01-01 01:01:01'),(67,20210421112652,1,'2020-01-01 01:01:01'),(68,20210506095025,1,'2020-01-01 01:01:01'),(69,20210513115729,1,'2020-01-01 01:01:01'),(70,20210526113559,1,'2020-01-01 01:01:01'),(71,20210601000001,1,'2020-01-01 01:01:01'),(72,20210601000002,1,'2020-01-01 01:01:01'),(73,20210601000003,1,'2020-01-01 01:01:01'),(74,20210601000004,1,'2020-01-01 01:01:01'),(75,20210601000005,1,'2020-01-01 01:01:01'),(76,20210601000006,1,'2020-01-01 01:01:01'),(77,20210601000007,1,'2020-01-01 01:01:01'),(78,20210601000008,1,'2020-01-01 01:01:01'),(79,20210606151329,1,'2020-01-01 01:01:01'),(80,20210616163757,1,'2020-01-01 01:01:01'),(81,20210617174723,1,'2020-01-01 01:01:01'),(82,20210622160235,1,'2020-01-01 01:01:01'),(83,20210623100031,1,'2020-01-01 01:01:01'),(84,20210623133615,1,'2020-01-01 01:01:01'),(85,20210708143152,1,'2020-01-01 01:01:01'),(86,20210709124443,1,'2020-01-01 01:01:01'),(87,20210712155608,1,'2020-01-01 01:01:01'),(88,20210714102108,1,'2020-01-01 01:01:01'),(89,20210719153709,1,'2020-01-01 01:01:01'),(90,20210721171531,1,'2020-01-01 01:01:01'),(91,20210723135713,1,'2020-01-01 01:01:01'),(92,20210802135933,1,'2020-01-01 01:01:01'),(93,20210806112844,1,'2020-01-01 01:01:01'),(94,20210810095603,1,'2020-01-01 01:01:01'),(95,20210811150223,1,'2020-01-01 01:01:01'),(96,20210818151827,1,'2020-01-01 01:01:01'),(97,20210818151828,1,'2020-01-01 01:01:01'),(98,20210818182258,1,'2020-01-01 01:01:01'),(99,20210819131107,1,'2020-01-01 01:01:01'),(100,20210819143446,1,'2020-01-01 01:01:01'),(101,20210903132338,1,'2020-01-01 01:01:01'),(102,20210915144307,1,'2020-01-01 01:01:01'),(103,20210920155130,1,'2020-01-01 01:01:01'),(104,20210927143115,1,'2020-01-01 01:01:01'),(105,20210927143116,1,'2020-01-01 01:01:01'),(106,20211013133706,1,'2020-01-01 01:01:01'),(107,20211013133707,1,'2020-01-01 01:01:01'),(108,20211102135149,1,'2020-01-01 01:01:01'),(109,20211109121546,1,'2020-01-01 01:01:01'),(110,20211110163320,1,'2020-01-01 01:01:01'),(111,20211116184029,1,'2020-01-01 01:01:01'),(112,20211116184030,1,'2020-01-01 01:01:01'),(113,20211202092042,1,'2020-01-01 01:01:01'),(114,20211202181033,1,'2020-01-01 01:01:01'),(115,20211207161856,1,'2020-01-01 01:01:01'),(116,20211216131203,1,'2020-01-01 01:01:01'),(117,20211221110132,1,'2020-01-01 01:01:01'),(118,20220107155700,1,'2020-01-01 01:01:01'),(119,20220125105650,1,'2020-01-01 01:01:01'),(120,20220201084510,1,'2020-01-01 01:01:01'),(121,20220208144830,1,'2020-01-01 01:01:01'),(122,20220208144831,1,'2020-01-01 01:01:01'),(123,20220215152203,1,'2020-01-01 01:01:01'),(124,20220223113157,1,'2020-01-01 01:01:01'),(125,20220307104655,1,'2020-01-01 01:01:01'),(126,20220309133956,1,'2020-01-01 01:01:01'),(127,20220316155700,1,'2020-01-01 01:01:01'),(128,20220323152301,1,'2020-01-01 01:01:01'),(129,20220330100659,1,'2020-01-01 01:01:01'),(130,20220404091216,1,'2020-01-01 01:01:01'),(131,20220419140750,1,'2020-01-01 01:01:01'),(132,20220428140039,1,'2020-01-01 01:01:01'),(133,20220503134048,1,'2020-01-01 01:01:01'),(134,20220524102918,1,'2020-01-01 01:01:01'),(135,20220526123327,1,'2020-01-01 01:01:01'),(136,20220526123328,1,'2020-01-01 01:01:01'),(137,20220526123329,1,'2020-01-01 01:01:01'),(138,20220608113128,1,'2020-01-01 01:01:01'),(139,20220627104817,1,'2020-01-01 01:01:01'),(140,20220704101843,1,'2020-01-01 01:01:01'),(141,20220708095046,1,'2020-01-01 01:01:01'),(142,20220713091130,1,'2020-01-01 01:01:01'),(143,20220802135510,1,'2020-01-01 01:01:01'),(144,20220818101352,1,'2020-01-01 01:01:01'),(145,20220822161445,1,'2020-01-01 01:01:01'),(146,20220831100036,1,'2020-01-01 01:01:01'),(147,20220831100151,1,'2020-01-01 01:01:01'),(148,20220908181826,1,'2020-01-01 01:01:01'),(149,20220914154915,1,'2020-01-01 01:01:01'),(150,20220915165115,1,'2020-01-01 01:01:01'),(151,20220915165116,1,'2020-01-01 01:01:01'),(152,20220928100158,1,'2020-01-01 01:01:01'),(153,20221014084130,1,'2020-01-01 01:01:01'),(154,20221027085019,1,'2020-01-01 01:01:01'),(155,20221101103952,1,'2020-01-01 01:01:01'),(156,20221104144401,1,'2020-01-01 01:01:01'),(157,20221109100749,1,'2020-01-01 01:01:01'),(158,20221115104546,1,'2020-01-01 01:01:01'),(159,20221130114928,1,'2020-01-01 01:01:01'),(160,20221205112142,1,'2020-01-01 01:01:01'),(161,20221216115820,1,'2020-01-01 01:01:01'),(162,20221220195934,1,'2020-01-01 01:01:01'),(163,20221220195935,1,'2020-01-01 01:01:01'),(164,20221223174807,1,'2020-01-01 01:01:01'),(165,20221227163855,1,'2020-01-01 01:01:01'),(166,20221227163856,1,'2020-01-01 01:01:01'),(167,20230202224725,1,'2020-01-01 01:01:01'),(168,20230206163608,1,'2020-01-01 01:01:01'),(169,20230214131519,1,'2020-01-01 01:01:01'),(170,20230303135738,1,'2020-01-01 01:01:01'),(171,20230313135301,1,'2020-01-01 01:01:01'),(172,20230313141819,1,'2020-01-01 01:01:01'),(173,20230315104937,1,'2020-01-01 01:01:01'),(174,20230317173844,1,'2020-01-01 01:01:01'),(175,20230320133602,1,'2020-01-01 01:01:01'),(176,20230330100011,1,'2020-01-01 01:01:01'),(177,20230330134823,1,'2020-01-01 01:01:01'),(178,20230405232025,1,'2020-01-01 01:01:01'),(179,20230408084104,1,'2020-01-01 01:01:01'),(180,20230411102858,1,'2020-01-01 01:01:01'),(181,20230421155932,1,'2020-01-01 01:01:01'),(182,20230425082126,1,'2020-01-01 01:01:01'),(183,20230425105727,1,'2020-01-01 01:01:01'),(184,20230501154913,1,'2020-01-01 01:01:01'),(185,20230503101418,1,'2020-01-01 01:01:01'),(186,20230515144206,1,'2020-01-01 01:01:01'),(187,20230517140952,1,'2020-01-01 01:01:01'),(188,20230517152807,1,'2020-01-01 01:01:01'),(189,20230518114155,1,'2020-01-01 01:01:01'),(190,20230520153236,1,'2020-01-01 01:01:01'),(191,20230525151159,1,'2020-01-01 01:01:01'),(192,20230530122103,1,'2020-01-01 01:01:01'),(193,20230602111827,1,'2020-01-01 01:01:01'),(194,20230608103123,1,'2020-01-01 01:01:01'),(195,20230629140529,1,'2020-01-01 01:01:01'),(196,20230629140530,1,'2020-01-01 01:01:01'),(197,20230711144622,1,'2020-01-01 01:01:01'),(198,20230721135421,1,'2020-01-01 01:01:01'),(199,20230721161508,1,'2020-01-01 01:01:01'),(200,20230726115701,1,'2020-01-01 01:01:01'),(201,20230807100822,1,'2020-01-01 01:01:01'),(202,20230814150442,1,'2020-01-01 01:01:01'),(203,20230823122728,1,'2020-01-01 01:01:01'),(204,20230906152143,1,'2020-01-01 01:01:01'),(205,20230911163618,1,'2020-01-01 01:01:01'),(206,20230912101759,1,'2020-01-01 01:01:01'),(207,20230915101341,1,'2020-01-01 01:01:01'),(208,20230918132351,1,'2020-01-01 01:01:01'),(209,20231004144339,1,'2020-01-01 01:01:01'),(210,20231009094541,1,'2020-01-01 01:01:01'),(211,20231009094542,1,'2020-01-01 01:01:01'),(212,20231009094543,1,'2020-01-01 01:01:01'),(213,20231009094544,1,'2020-01-01 01:01:01'),(214,20231016091915,1,'2020-01-01 01:01:01'),(215,20231024174135,1,'2020-01-01 01:01:01'),(216,20231025120016,1,'2020-01-01 01:01:01'),(217,20231025160156,1,'2020-01-01 01:01:01'),(218,20231031165350,1,'2020-01-01 01:01:01'),(219,20231106144110,1,'2020-01-01 01:01:01'),(220,20231107130934,1,'2020-01-01 01:01:01'),(221,20231109115838,1,'2020-01-01 01:01:01'),(222,20231121054530,1,'2020-01-01 01:01:01'),(223,20231122101320,1,'2020-01-01 01:01:01'),(224,20231130132828,1,'2020-01-01 01:01:01'),(225,20231130132931,1,'2020-01-01 01:01:01'),(226,20231204155427,1,'2020-01-01 01:01:01'),(227,20231206142340,1,'2020-01-01 01:01:01'),(228,20231207102320,1,'2020-01-01 01:01:01'),(229,20231207102321,1,'2020-01-01 01:01:01'),(230,20231207133731,1,'2020-01-01 01:01:01'),(231,20231212094238,1,'2020-01-01 01:01:01'),(232,20231212095734,1,'2020-01-01 01:01:01'),(233,20231212161121,1,'2020-01-01 01:01:01'),(234,20231215122713,1,'2020-01-01 01:01:01'),(235,20231219143041,1,'2020-01-01 01:01:01'),(236,20231224070653,1,'2020-01-01 01:01:01'),(237,20240110134315,1,'2020-01-01 01:01:01'),(238,20240119091637,1,'2020-01-01 01:01:01'),(239,20240126020642,1,'2020-01-01 01:01:01'),(240,20240126020643,1,'2020-01-01 01:01:01'),(241,20240129162819,1,'2020-01-01 01:01:01'),(242,20240130115133,1,'2020-01-01 01:01:01'),(243,20240131083822,1,'2020-01-01 01:01:01'),(244,20240205095928,1,'2020-01-01 01:01:01'),(245,20240205121956,1,'2020-01-01 01:01:01'),(246,20240209110212,1,'2020-01-01 01:01:01'),(247,20240212111533,1,'2020-01-01 01:01:01'),(248,20240221112844,1,'2020-01-01 01:01:01'),(249,20240222073518,1,'2020-01-01 01:01:01'),(250,20240222135115,1,'2020-01-01 01:01:01'),(251,20240226082255,1,'2020-01-01 01:01:01'),(252,20240228082706,1,'2020-01-01 01:01:01'),(253,20240301173035,1,'2020-01-01 01:01:01'),(254,20240302111134,1,'2020-01-01 01:01:01'),(255,20240312103753,1,'2020-01-01 01:01:01'),(256,20240313143416,1,'2020-01-01 01:01:01'),(257,20240314085226,1,'2020-01-01 01:01:01'),(258,20240314151747,1,'2020-01-01 01:01:01'),(259,20240320145650,1,'2020-01-01 01:01:01'),(260,20240327115530,1,'2020-01-01 01:01:01'),(261,20240327115617,1,'2020-01-01 01:01:01'),(262,20240408085837,1,'2020-01-01 01:01:01'),(263,20240415104633,1,'2020-01-01 01:01:01'),(264,20240430111727,1,'2020-01-01 01:01:01'),(265,20240515200020,1,'2020-01-01 01:01:01'),(266,20240521143023,1,'2020-01-01 01:01:01'),(267,20240521143024,1,'2020-01-01 01:01:01'),(268,20240601174138,1,'2020-01-01 01:01:01'),(269,20240607133721,1,'2020-01-01 01:01:01'),(270,20240612150059,1,'2020-01-01 01:01:01'),(271,20240613162201,1,'2020-01-01 01:01:01'),(272,20240613172616,1,'2020-01-01 01:01:01'),(273,20240618142419,1,'2020-01-01 01:01:01'),(274,20240625093543,1,'2020-01-01 01:01:01'),(275,20240626195531,1,'2020-01-01 01:01:01'),(276,20240702123921,1,'2020-01-01 01:01:01'),(277,20240703154849,1,'2020-01-01 01:01:01'),(278,20240707134035,1,'2020-01-01 01:01:01'),(279,20240707134036,1,'2020-01-01 01:01:01'),(280,20240709124958,1,'2020-01-01 01:01:01'),(281,20240709132642,1,'2020-01-01 01:01:01'),(282,20240709183940,1,'2020-01-01 01:01:01'),(283,20240710155623,1,'2020-01-01 01:01:01'),(284,20240723102712,1,'2020-01-01 01:01:01'),(285,20240725152735,1,'2020-01-01 01:01:01'),(286,20240725182118,1,'2020-01-01 01:01:01'),(287,20240726100517,1,'2020-01-01 01:01:01'),(288,20240730171504,1,'2020-01-01 01:01:01'),(289,20240730174056,1,'2020-01-01 01:01:01'),(290,20240730215453,1,'2020-01-01 01:01:01'),(291,20240730374423,1,'2020-01-01 01:01:01'),(292,20240801115359,1,'2020-01-01 01:01:01'),(293,20240802101043,1,'2020-01-01 01:01:01'),(294,20240802113716,1,'2020-01-01 01:01:01'),(295,20240814135330,1,'2020-01-01 01:01:01'),(296,20240815000000,1,'2020-01-01 01:01:01'),(297,20240815000001,1,'2020-01-01 01:01:01'),(298,20240816103247,1,'2020-01-01 01:01:01'),(299,20240820091218,1,'2020-01-01 01:01:01'),(300,20240826111228,1,'2020-01-01 01:01:01'),(301,20240826160025,1,'2020-01-01 01:01:01'),(302,20240829165448,1,'2020-01-01 01:01:01'),(303,20240829165605,1,'2020-01-01 01:01:01'),(304,20240829165715,1,'2020-01-01 01:01:01'),(305,20240829165930,1,'2020-01-01 01:01:01'),(306,20240829170023,1,'2020-01-01 01:01:01'),(307,20240829170033,1,'2020-01-01 01:01:01'),(308,20240829170044,1,'2020-01-01 01:01:01'),(309,20240905105135,1,'2020-01-01 01:01:01'),(310,20240905140514,1,'2020-01-01 01:01:01'),(311,20240905200000,1,'2020-01-01 01:01:01'),(312,20240905200001,1,'2020-01-01 01:01:01'),(313,20241002104104,1,'2020-01-01 01:01:01'),(314,20241002104105,1,'2020-01-01 01:01:01'),(315,20241002104106,1,'2020-01-01 01:01:01'),(316,20241002210000,1,'2020-01-01 01:01:01'),(317,20241003145349,1,'2020-01-01 01:01:01'),(318,20241004005000,1,'2020-01-01 01:01:01'),(319,20241008083925,1,'2020-01-01 01:01:01'),(320,20241009090010,1,'2020-01-01 01:01:01'),(321,20241017163402,1,'2020-01-01 01:01:01'),(322,20241021224359,1,'2020-01-01 01:01:01'),(323,20241022140321,1,'2020-01-01 01:01:01'),(324,20241025111236,1,'2020-01-01 01:01:01'),(325,20241025112748,1,'2020-01-01 01:01:01'),(326,20241025141855,1,'2020-01-01 01:01:01'),(327,20241110152839,1,'2020-01-01 01:01:01'),(328,20241110152840,1,'2020-01-01 01:01:01'),(329,20241110152841,1,'2020-01-01 01:01:01'),(330,20241116233322,1,'2020-01-01 01:01:01'),(331,20241122171434,1,'2020-01-01 01:01:01'),(332,20241125150614,1,'2020-01-01 01:01:01'),(333,20241203125346,1,'2020-01-01 01:01:01'),(334,20241203130032,1,'2020-01-01 01:01:01'),(335,20241205122800,1,'2020-01-01 01:01:01'),(336,20241209164540,1,'2020-01-01 01:01:01'),(337,20241210140021,1,'2020-01-01 01:01:01'),(338,20241219180042,1,'2020-01-01 01:01:01'),(339,20241220100000,1,'2020-01-01 01:01:01'),(340,20241220114903,1,'2020-01-01 01:01:01'),(341,20241220114904,1,'2020-01-01 01:01:01'),(342,20241224000000,1,'2020-01-01 01:01:01'),(343,20241230000000,1,'2020-01-01 01:01:01'),(344,20241231112624,1,'2020-01-01 01:01:01'),(345,20250102121439,1,'2020-01-01 01:01:01'),(346,20250121094045,1,'2020-01-01 01:01:01'),(347,20250121094500,1,'2020-01-01 01:01:01'),(348,20250121094600,1,'2020-01-01 01:01:01'),(349,20250121094700,1,'2020-01-01 01:01:01'),(350,20250124194347,1,'2020-01-01 01:01:01'),(351,20250127162751,1,'2020-01-01 01:01:01'),(352,20250213104005,1,'2020-01-01 01:01:01'),(353,20250214205657,1,'2020-01-01 01:01:01'),(354,20250217093329,1,'2020-01-01 01:01:01'),(355,20250219090511,1,'2020-01-01 01:01:01'),(356,20250219100000,1,'2020-01-01 01:01:01'),(357,20250219142401,1,'2020-01-01 01:01:01'),(358,20250224184002,1,'2020-01-01 01:01:01'),(359,20250225085436,1,'2020-01-01 01:01:01'),(360,20250226000000,1,'2020-01-01 01:01:01'),(361,20250226153445,1,'2020-01-01 01:01:01'),(362,20250304162702,1,'2020-01-01 01:01:01'),(363,20250306144233,1,'2020-01-01 01:01:01'),(364,20250313163430,1,'2020-01-01 01:01:01'),(365,20250317130944,1,'2020-01-01 01:01:01'),(366,20250318165922,1,'2020-01-01 01:01:01'),(367,20250320132525,1,'2020-01-01 01:01:01'),(368,20250320200000,1,'2020-01-01 01:01:01'),(369,20250326161930,1,'2020-01-01 01:01:01'),(370,20250326161931,1,'2020-01-01 01:01:01'),(371,20250331042354,1,'2020-01-01 01:01:01'),(372,20250331154206,1,'2020-01-01 01:01:01'),(373,20250401155831,1,'2020-01-01 01:01:01'),(374,20250408133233,1,'2020-01-01 01:01:01'),(375,20250410104321,1,'2020-01-01 01:01:01'),(376,20250421085116,1,'2020-01-01 01:01:01'),(377,20250422095806,1,'2020-01-01 01:01:01'),(378,20250424153059,1,'2020-01-01 01:01:01'),(379,20250430103833,1,'2020-01-01 01:01:01'),(380,20250430112622,1,'2020-01-01 01:01:01'),(381,20250501162727,1,'2020-01-01 01:01:01'),(382,20250502154517,1,'2020-01-01 01:01:01'),(383,20250502222222,1,'2020-01-01 01:01:01'),(384,20250507170845,1,'2020-01-01 01:01:01'),(385,20250513162912,1,'2020-01-01 01:01:01'),(386,20250519161614,1,'2020-01-01 01:01:01'),(387,20250520153848,1,'2020-01-01 01:01:01'),(388,20250528102714,1,'2020-01-01 01:01:01'),(389,20250528115932,1,'2020-01-01 01:01:01'); +INSERT INTO `migration_status_tables` VALUES (1,0,1,'2020-01-01 01:01:01'),(2,20161118193812,1,'2020-01-01 01:01:01'),(3,20161118211713,1,'2020-01-01 01:01:01'),(4,20161118212436,1,'2020-01-01 01:01:01'),(5,20161118212515,1,'2020-01-01 01:01:01'),(6,20161118212528,1,'2020-01-01 01:01:01'),(7,20161118212538,1,'2020-01-01 01:01:01'),(8,20161118212549,1,'2020-01-01 01:01:01'),(9,20161118212557,1,'2020-01-01 01:01:01'),(10,20161118212604,1,'2020-01-01 01:01:01'),(11,20161118212613,1,'2020-01-01 01:01:01'),(12,20161118212621,1,'2020-01-01 01:01:01'),(13,20161118212630,1,'2020-01-01 01:01:01'),(14,20161118212641,1,'2020-01-01 01:01:01'),(15,20161118212649,1,'2020-01-01 01:01:01'),(16,20161118212656,1,'2020-01-01 01:01:01'),(17,20161118212758,1,'2020-01-01 01:01:01'),(18,20161128234849,1,'2020-01-01 01:01:01'),(19,20161230162221,1,'2020-01-01 01:01:01'),(20,20170104113816,1,'2020-01-01 01:01:01'),(21,20170105151732,1,'2020-01-01 01:01:01'),(22,20170108191242,1,'2020-01-01 01:01:01'),(23,20170109094020,1,'2020-01-01 01:01:01'),(24,20170109130438,1,'2020-01-01 01:01:01'),(25,20170110202752,1,'2020-01-01 01:01:01'),(26,20170111133013,1,'2020-01-01 01:01:01'),(27,20170117025759,1,'2020-01-01 01:01:01'),(28,20170118191001,1,'2020-01-01 01:01:01'),(29,20170119234632,1,'2020-01-01 01:01:01'),(30,20170124230432,1,'2020-01-01 01:01:01'),(31,20170127014618,1,'2020-01-01 01:01:01'),(32,20170131232841,1,'2020-01-01 01:01:01'),(33,20170223094154,1,'2020-01-01 01:01:01'),(34,20170306075207,1,'2020-01-01 01:01:01'),(35,20170309100733,1,'2020-01-01 01:01:01'),(36,20170331111922,1,'2020-01-01 01:01:01'),(37,20170502143928,1,'2020-01-01 01:01:01'),(38,20170504130602,1,'2020-01-01 01:01:01'),(39,20170509132100,1,'2020-01-01 01:01:01'),(40,20170519105647,1,'2020-01-01 01:01:01'),(41,20170519105648,1,'2020-01-01 01:01:01'),(42,20170831234300,1,'2020-01-01 01:01:01'),(43,20170831234301,1,'2020-01-01 01:01:01'),(44,20170831234303,1,'2020-01-01 01:01:01'),(45,20171116163618,1,'2020-01-01 01:01:01'),(46,20171219164727,1,'2020-01-01 01:01:01'),(47,20180620164811,1,'2020-01-01 01:01:01'),(48,20180620175054,1,'2020-01-01 01:01:01'),(49,20180620175055,1,'2020-01-01 01:01:01'),(50,20191010101639,1,'2020-01-01 01:01:01'),(51,20191010155147,1,'2020-01-01 01:01:01'),(52,20191220130734,1,'2020-01-01 01:01:01'),(53,20200311140000,1,'2020-01-01 01:01:01'),(54,20200405120000,1,'2020-01-01 01:01:01'),(55,20200407120000,1,'2020-01-01 01:01:01'),(56,20200420120000,1,'2020-01-01 01:01:01'),(57,20200504120000,1,'2020-01-01 01:01:01'),(58,20200512120000,1,'2020-01-01 01:01:01'),(59,20200707120000,1,'2020-01-01 01:01:01'),(60,20201011162341,1,'2020-01-01 01:01:01'),(61,20201021104586,1,'2020-01-01 01:01:01'),(62,20201102112520,1,'2020-01-01 01:01:01'),(63,20201208121729,1,'2020-01-01 01:01:01'),(64,20201215091637,1,'2020-01-01 01:01:01'),(65,20210119174155,1,'2020-01-01 01:01:01'),(66,20210326182902,1,'2020-01-01 01:01:01'),(67,20210421112652,1,'2020-01-01 01:01:01'),(68,20210506095025,1,'2020-01-01 01:01:01'),(69,20210513115729,1,'2020-01-01 01:01:01'),(70,20210526113559,1,'2020-01-01 01:01:01'),(71,20210601000001,1,'2020-01-01 01:01:01'),(72,20210601000002,1,'2020-01-01 01:01:01'),(73,20210601000003,1,'2020-01-01 01:01:01'),(74,20210601000004,1,'2020-01-01 01:01:01'),(75,20210601000005,1,'2020-01-01 01:01:01'),(76,20210601000006,1,'2020-01-01 01:01:01'),(77,20210601000007,1,'2020-01-01 01:01:01'),(78,20210601000008,1,'2020-01-01 01:01:01'),(79,20210606151329,1,'2020-01-01 01:01:01'),(80,20210616163757,1,'2020-01-01 01:01:01'),(81,20210617174723,1,'2020-01-01 01:01:01'),(82,20210622160235,1,'2020-01-01 01:01:01'),(83,20210623100031,1,'2020-01-01 01:01:01'),(84,20210623133615,1,'2020-01-01 01:01:01'),(85,20210708143152,1,'2020-01-01 01:01:01'),(86,20210709124443,1,'2020-01-01 01:01:01'),(87,20210712155608,1,'2020-01-01 01:01:01'),(88,20210714102108,1,'2020-01-01 01:01:01'),(89,20210719153709,1,'2020-01-01 01:01:01'),(90,20210721171531,1,'2020-01-01 01:01:01'),(91,20210723135713,1,'2020-01-01 01:01:01'),(92,20210802135933,1,'2020-01-01 01:01:01'),(93,20210806112844,1,'2020-01-01 01:01:01'),(94,20210810095603,1,'2020-01-01 01:01:01'),(95,20210811150223,1,'2020-01-01 01:01:01'),(96,20210818151827,1,'2020-01-01 01:01:01'),(97,20210818151828,1,'2020-01-01 01:01:01'),(98,20210818182258,1,'2020-01-01 01:01:01'),(99,20210819131107,1,'2020-01-01 01:01:01'),(100,20210819143446,1,'2020-01-01 01:01:01'),(101,20210903132338,1,'2020-01-01 01:01:01'),(102,20210915144307,1,'2020-01-01 01:01:01'),(103,20210920155130,1,'2020-01-01 01:01:01'),(104,20210927143115,1,'2020-01-01 01:01:01'),(105,20210927143116,1,'2020-01-01 01:01:01'),(106,20211013133706,1,'2020-01-01 01:01:01'),(107,20211013133707,1,'2020-01-01 01:01:01'),(108,20211102135149,1,'2020-01-01 01:01:01'),(109,20211109121546,1,'2020-01-01 01:01:01'),(110,20211110163320,1,'2020-01-01 01:01:01'),(111,20211116184029,1,'2020-01-01 01:01:01'),(112,20211116184030,1,'2020-01-01 01:01:01'),(113,20211202092042,1,'2020-01-01 01:01:01'),(114,20211202181033,1,'2020-01-01 01:01:01'),(115,20211207161856,1,'2020-01-01 01:01:01'),(116,20211216131203,1,'2020-01-01 01:01:01'),(117,20211221110132,1,'2020-01-01 01:01:01'),(118,20220107155700,1,'2020-01-01 01:01:01'),(119,20220125105650,1,'2020-01-01 01:01:01'),(120,20220201084510,1,'2020-01-01 01:01:01'),(121,20220208144830,1,'2020-01-01 01:01:01'),(122,20220208144831,1,'2020-01-01 01:01:01'),(123,20220215152203,1,'2020-01-01 01:01:01'),(124,20220223113157,1,'2020-01-01 01:01:01'),(125,20220307104655,1,'2020-01-01 01:01:01'),(126,20220309133956,1,'2020-01-01 01:01:01'),(127,20220316155700,1,'2020-01-01 01:01:01'),(128,20220323152301,1,'2020-01-01 01:01:01'),(129,20220330100659,1,'2020-01-01 01:01:01'),(130,20220404091216,1,'2020-01-01 01:01:01'),(131,20220419140750,1,'2020-01-01 01:01:01'),(132,20220428140039,1,'2020-01-01 01:01:01'),(133,20220503134048,1,'2020-01-01 01:01:01'),(134,20220524102918,1,'2020-01-01 01:01:01'),(135,20220526123327,1,'2020-01-01 01:01:01'),(136,20220526123328,1,'2020-01-01 01:01:01'),(137,20220526123329,1,'2020-01-01 01:01:01'),(138,20220608113128,1,'2020-01-01 01:01:01'),(139,20220627104817,1,'2020-01-01 01:01:01'),(140,20220704101843,1,'2020-01-01 01:01:01'),(141,20220708095046,1,'2020-01-01 01:01:01'),(142,20220713091130,1,'2020-01-01 01:01:01'),(143,20220802135510,1,'2020-01-01 01:01:01'),(144,20220818101352,1,'2020-01-01 01:01:01'),(145,20220822161445,1,'2020-01-01 01:01:01'),(146,20220831100036,1,'2020-01-01 01:01:01'),(147,20220831100151,1,'2020-01-01 01:01:01'),(148,20220908181826,1,'2020-01-01 01:01:01'),(149,20220914154915,1,'2020-01-01 01:01:01'),(150,20220915165115,1,'2020-01-01 01:01:01'),(151,20220915165116,1,'2020-01-01 01:01:01'),(152,20220928100158,1,'2020-01-01 01:01:01'),(153,20221014084130,1,'2020-01-01 01:01:01'),(154,20221027085019,1,'2020-01-01 01:01:01'),(155,20221101103952,1,'2020-01-01 01:01:01'),(156,20221104144401,1,'2020-01-01 01:01:01'),(157,20221109100749,1,'2020-01-01 01:01:01'),(158,20221115104546,1,'2020-01-01 01:01:01'),(159,20221130114928,1,'2020-01-01 01:01:01'),(160,20221205112142,1,'2020-01-01 01:01:01'),(161,20221216115820,1,'2020-01-01 01:01:01'),(162,20221220195934,1,'2020-01-01 01:01:01'),(163,20221220195935,1,'2020-01-01 01:01:01'),(164,20221223174807,1,'2020-01-01 01:01:01'),(165,20221227163855,1,'2020-01-01 01:01:01'),(166,20221227163856,1,'2020-01-01 01:01:01'),(167,20230202224725,1,'2020-01-01 01:01:01'),(168,20230206163608,1,'2020-01-01 01:01:01'),(169,20230214131519,1,'2020-01-01 01:01:01'),(170,20230303135738,1,'2020-01-01 01:01:01'),(171,20230313135301,1,'2020-01-01 01:01:01'),(172,20230313141819,1,'2020-01-01 01:01:01'),(173,20230315104937,1,'2020-01-01 01:01:01'),(174,20230317173844,1,'2020-01-01 01:01:01'),(175,20230320133602,1,'2020-01-01 01:01:01'),(176,20230330100011,1,'2020-01-01 01:01:01'),(177,20230330134823,1,'2020-01-01 01:01:01'),(178,20230405232025,1,'2020-01-01 01:01:01'),(179,20230408084104,1,'2020-01-01 01:01:01'),(180,20230411102858,1,'2020-01-01 01:01:01'),(181,20230421155932,1,'2020-01-01 01:01:01'),(182,20230425082126,1,'2020-01-01 01:01:01'),(183,20230425105727,1,'2020-01-01 01:01:01'),(184,20230501154913,1,'2020-01-01 01:01:01'),(185,20230503101418,1,'2020-01-01 01:01:01'),(186,20230515144206,1,'2020-01-01 01:01:01'),(187,20230517140952,1,'2020-01-01 01:01:01'),(188,20230517152807,1,'2020-01-01 01:01:01'),(189,20230518114155,1,'2020-01-01 01:01:01'),(190,20230520153236,1,'2020-01-01 01:01:01'),(191,20230525151159,1,'2020-01-01 01:01:01'),(192,20230530122103,1,'2020-01-01 01:01:01'),(193,20230602111827,1,'2020-01-01 01:01:01'),(194,20230608103123,1,'2020-01-01 01:01:01'),(195,20230629140529,1,'2020-01-01 01:01:01'),(196,20230629140530,1,'2020-01-01 01:01:01'),(197,20230711144622,1,'2020-01-01 01:01:01'),(198,20230721135421,1,'2020-01-01 01:01:01'),(199,20230721161508,1,'2020-01-01 01:01:01'),(200,20230726115701,1,'2020-01-01 01:01:01'),(201,20230807100822,1,'2020-01-01 01:01:01'),(202,20230814150442,1,'2020-01-01 01:01:01'),(203,20230823122728,1,'2020-01-01 01:01:01'),(204,20230906152143,1,'2020-01-01 01:01:01'),(205,20230911163618,1,'2020-01-01 01:01:01'),(206,20230912101759,1,'2020-01-01 01:01:01'),(207,20230915101341,1,'2020-01-01 01:01:01'),(208,20230918132351,1,'2020-01-01 01:01:01'),(209,20231004144339,1,'2020-01-01 01:01:01'),(210,20231009094541,1,'2020-01-01 01:01:01'),(211,20231009094542,1,'2020-01-01 01:01:01'),(212,20231009094543,1,'2020-01-01 01:01:01'),(213,20231009094544,1,'2020-01-01 01:01:01'),(214,20231016091915,1,'2020-01-01 01:01:01'),(215,20231024174135,1,'2020-01-01 01:01:01'),(216,20231025120016,1,'2020-01-01 01:01:01'),(217,20231025160156,1,'2020-01-01 01:01:01'),(218,20231031165350,1,'2020-01-01 01:01:01'),(219,20231106144110,1,'2020-01-01 01:01:01'),(220,20231107130934,1,'2020-01-01 01:01:01'),(221,20231109115838,1,'2020-01-01 01:01:01'),(222,20231121054530,1,'2020-01-01 01:01:01'),(223,20231122101320,1,'2020-01-01 01:01:01'),(224,20231130132828,1,'2020-01-01 01:01:01'),(225,20231130132931,1,'2020-01-01 01:01:01'),(226,20231204155427,1,'2020-01-01 01:01:01'),(227,20231206142340,1,'2020-01-01 01:01:01'),(228,20231207102320,1,'2020-01-01 01:01:01'),(229,20231207102321,1,'2020-01-01 01:01:01'),(230,20231207133731,1,'2020-01-01 01:01:01'),(231,20231212094238,1,'2020-01-01 01:01:01'),(232,20231212095734,1,'2020-01-01 01:01:01'),(233,20231212161121,1,'2020-01-01 01:01:01'),(234,20231215122713,1,'2020-01-01 01:01:01'),(235,20231219143041,1,'2020-01-01 01:01:01'),(236,20231224070653,1,'2020-01-01 01:01:01'),(237,20240110134315,1,'2020-01-01 01:01:01'),(238,20240119091637,1,'2020-01-01 01:01:01'),(239,20240126020642,1,'2020-01-01 01:01:01'),(240,20240126020643,1,'2020-01-01 01:01:01'),(241,20240129162819,1,'2020-01-01 01:01:01'),(242,20240130115133,1,'2020-01-01 01:01:01'),(243,20240131083822,1,'2020-01-01 01:01:01'),(244,20240205095928,1,'2020-01-01 01:01:01'),(245,20240205121956,1,'2020-01-01 01:01:01'),(246,20240209110212,1,'2020-01-01 01:01:01'),(247,20240212111533,1,'2020-01-01 01:01:01'),(248,20240221112844,1,'2020-01-01 01:01:01'),(249,20240222073518,1,'2020-01-01 01:01:01'),(250,20240222135115,1,'2020-01-01 01:01:01'),(251,20240226082255,1,'2020-01-01 01:01:01'),(252,20240228082706,1,'2020-01-01 01:01:01'),(253,20240301173035,1,'2020-01-01 01:01:01'),(254,20240302111134,1,'2020-01-01 01:01:01'),(255,20240312103753,1,'2020-01-01 01:01:01'),(256,20240313143416,1,'2020-01-01 01:01:01'),(257,20240314085226,1,'2020-01-01 01:01:01'),(258,20240314151747,1,'2020-01-01 01:01:01'),(259,20240320145650,1,'2020-01-01 01:01:01'),(260,20240327115530,1,'2020-01-01 01:01:01'),(261,20240327115617,1,'2020-01-01 01:01:01'),(262,20240408085837,1,'2020-01-01 01:01:01'),(263,20240415104633,1,'2020-01-01 01:01:01'),(264,20240430111727,1,'2020-01-01 01:01:01'),(265,20240515200020,1,'2020-01-01 01:01:01'),(266,20240521143023,1,'2020-01-01 01:01:01'),(267,20240521143024,1,'2020-01-01 01:01:01'),(268,20240601174138,1,'2020-01-01 01:01:01'),(269,20240607133721,1,'2020-01-01 01:01:01'),(270,20240612150059,1,'2020-01-01 01:01:01'),(271,20240613162201,1,'2020-01-01 01:01:01'),(272,20240613172616,1,'2020-01-01 01:01:01'),(273,20240618142419,1,'2020-01-01 01:01:01'),(274,20240625093543,1,'2020-01-01 01:01:01'),(275,20240626195531,1,'2020-01-01 01:01:01'),(276,20240702123921,1,'2020-01-01 01:01:01'),(277,20240703154849,1,'2020-01-01 01:01:01'),(278,20240707134035,1,'2020-01-01 01:01:01'),(279,20240707134036,1,'2020-01-01 01:01:01'),(280,20240709124958,1,'2020-01-01 01:01:01'),(281,20240709132642,1,'2020-01-01 01:01:01'),(282,20240709183940,1,'2020-01-01 01:01:01'),(283,20240710155623,1,'2020-01-01 01:01:01'),(284,20240723102712,1,'2020-01-01 01:01:01'),(285,20240725152735,1,'2020-01-01 01:01:01'),(286,20240725182118,1,'2020-01-01 01:01:01'),(287,20240726100517,1,'2020-01-01 01:01:01'),(288,20240730171504,1,'2020-01-01 01:01:01'),(289,20240730174056,1,'2020-01-01 01:01:01'),(290,20240730215453,1,'2020-01-01 01:01:01'),(291,20240730374423,1,'2020-01-01 01:01:01'),(292,20240801115359,1,'2020-01-01 01:01:01'),(293,20240802101043,1,'2020-01-01 01:01:01'),(294,20240802113716,1,'2020-01-01 01:01:01'),(295,20240814135330,1,'2020-01-01 01:01:01'),(296,20240815000000,1,'2020-01-01 01:01:01'),(297,20240815000001,1,'2020-01-01 01:01:01'),(298,20240816103247,1,'2020-01-01 01:01:01'),(299,20240820091218,1,'2020-01-01 01:01:01'),(300,20240826111228,1,'2020-01-01 01:01:01'),(301,20240826160025,1,'2020-01-01 01:01:01'),(302,20240829165448,1,'2020-01-01 01:01:01'),(303,20240829165605,1,'2020-01-01 01:01:01'),(304,20240829165715,1,'2020-01-01 01:01:01'),(305,20240829165930,1,'2020-01-01 01:01:01'),(306,20240829170023,1,'2020-01-01 01:01:01'),(307,20240829170033,1,'2020-01-01 01:01:01'),(308,20240829170044,1,'2020-01-01 01:01:01'),(309,20240905105135,1,'2020-01-01 01:01:01'),(310,20240905140514,1,'2020-01-01 01:01:01'),(311,20240905200000,1,'2020-01-01 01:01:01'),(312,20240905200001,1,'2020-01-01 01:01:01'),(313,20241002104104,1,'2020-01-01 01:01:01'),(314,20241002104105,1,'2020-01-01 01:01:01'),(315,20241002104106,1,'2020-01-01 01:01:01'),(316,20241002210000,1,'2020-01-01 01:01:01'),(317,20241003145349,1,'2020-01-01 01:01:01'),(318,20241004005000,1,'2020-01-01 01:01:01'),(319,20241008083925,1,'2020-01-01 01:01:01'),(320,20241009090010,1,'2020-01-01 01:01:01'),(321,20241017163402,1,'2020-01-01 01:01:01'),(322,20241021224359,1,'2020-01-01 01:01:01'),(323,20241022140321,1,'2020-01-01 01:01:01'),(324,20241025111236,1,'2020-01-01 01:01:01'),(325,20241025112748,1,'2020-01-01 01:01:01'),(326,20241025141855,1,'2020-01-01 01:01:01'),(327,20241110152839,1,'2020-01-01 01:01:01'),(328,20241110152840,1,'2020-01-01 01:01:01'),(329,20241110152841,1,'2020-01-01 01:01:01'),(330,20241116233322,1,'2020-01-01 01:01:01'),(331,20241122171434,1,'2020-01-01 01:01:01'),(332,20241125150614,1,'2020-01-01 01:01:01'),(333,20241203125346,1,'2020-01-01 01:01:01'),(334,20241203130032,1,'2020-01-01 01:01:01'),(335,20241205122800,1,'2020-01-01 01:01:01'),(336,20241209164540,1,'2020-01-01 01:01:01'),(337,20241210140021,1,'2020-01-01 01:01:01'),(338,20241219180042,1,'2020-01-01 01:01:01'),(339,20241220100000,1,'2020-01-01 01:01:01'),(340,20241220114903,1,'2020-01-01 01:01:01'),(341,20241220114904,1,'2020-01-01 01:01:01'),(342,20241224000000,1,'2020-01-01 01:01:01'),(343,20241230000000,1,'2020-01-01 01:01:01'),(344,20241231112624,1,'2020-01-01 01:01:01'),(345,20250102121439,1,'2020-01-01 01:01:01'),(346,20250121094045,1,'2020-01-01 01:01:01'),(347,20250121094500,1,'2020-01-01 01:01:01'),(348,20250121094600,1,'2020-01-01 01:01:01'),(349,20250121094700,1,'2020-01-01 01:01:01'),(350,20250124194347,1,'2020-01-01 01:01:01'),(351,20250127162751,1,'2020-01-01 01:01:01'),(352,20250213104005,1,'2020-01-01 01:01:01'),(353,20250214205657,1,'2020-01-01 01:01:01'),(354,20250217093329,1,'2020-01-01 01:01:01'),(355,20250219090511,1,'2020-01-01 01:01:01'),(356,20250219100000,1,'2020-01-01 01:01:01'),(357,20250219142401,1,'2020-01-01 01:01:01'),(358,20250224184002,1,'2020-01-01 01:01:01'),(359,20250225085436,1,'2020-01-01 01:01:01'),(360,20250226000000,1,'2020-01-01 01:01:01'),(361,20250226153445,1,'2020-01-01 01:01:01'),(362,20250304162702,1,'2020-01-01 01:01:01'),(363,20250306144233,1,'2020-01-01 01:01:01'),(364,20250313163430,1,'2020-01-01 01:01:01'),(365,20250317130944,1,'2020-01-01 01:01:01'),(366,20250318165922,1,'2020-01-01 01:01:01'),(367,20250320132525,1,'2020-01-01 01:01:01'),(368,20250320200000,1,'2020-01-01 01:01:01'),(369,20250326161930,1,'2020-01-01 01:01:01'),(370,20250326161931,1,'2020-01-01 01:01:01'),(371,20250331042354,1,'2020-01-01 01:01:01'),(372,20250331154206,1,'2020-01-01 01:01:01'),(373,20250401155831,1,'2020-01-01 01:01:01'),(374,20250408133233,1,'2020-01-01 01:01:01'),(375,20250410104321,1,'2020-01-01 01:01:01'),(376,20250421085116,1,'2020-01-01 01:01:01'),(377,20250422095806,1,'2020-01-01 01:01:01'),(378,20250424153059,1,'2020-01-01 01:01:01'),(379,20250430103833,1,'2020-01-01 01:01:01'),(380,20250430112622,1,'2020-01-01 01:01:01'),(381,20250501162727,1,'2020-01-01 01:01:01'),(382,20250502154517,1,'2020-01-01 01:01:01'),(383,20250502222222,1,'2020-01-01 01:01:01'),(384,20250507170845,1,'2020-01-01 01:01:01'),(385,20250513162912,1,'2020-01-01 01:01:01'),(386,20250519161614,1,'2020-01-01 01:01:01'),(387,20250520153848,1,'2020-01-01 01:01:01'),(388,20250528102714,1,'2020-01-01 01:01:01'),(389,20250528115932,1,'2020-01-01 01:01:01'),(390,20250529102706,1,'2020-01-01 01:01:01'); /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mobile_device_management_solutions` ( @@ -1336,7 +1336,7 @@ CREATE TABLE `mobile_device_management_solutions` ( `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`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -1347,7 +1347,7 @@ CREATE TABLE `munki_issues` ( `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `idx_munki_issues_name` (`name`,`issue_type`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -1383,7 +1383,7 @@ CREATE TABLE `nano_command_results` ( 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_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; +) 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 */; @@ -1620,7 +1620,7 @@ CREATE TABLE `osquery_options` ( `override_identifier` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `options` json NOT NULL, PRIMARY KEY (`id`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -1764,11 +1764,11 @@ CREATE TABLE `queries` ( `observer_can_run` tinyint(1) NOT NULL DEFAULT '0', `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 '', + `platform` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `min_osquery_version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `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', + `logging_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'snapshot', `discard_data` tinyint(1) NOT NULL DEFAULT '1', `is_scheduled` tinyint(1) GENERATED ALWAYS AS ((`schedule_interval` > 0)) STORED NOT NULL, PRIMARY KEY (`id`), @@ -1825,7 +1825,7 @@ CREATE TABLE `scep_certificates` ( 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; +) 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 */; @@ -2099,7 +2099,7 @@ CREATE TABLE `software` ( /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `software_categories` ( `id` int unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(63) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_software_categories_name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -2280,7 +2280,7 @@ CREATE TABLE `statistics` ( `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `anonymous_identifier` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -2329,7 +2329,7 @@ CREATE TABLE `user_teams` ( 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 -) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) 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 */; @@ -2345,7 +2345,7 @@ CREATE TABLE `users` ( `gravatar_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `position` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `sso_enabled` tinyint NOT NULL DEFAULT '0', - `global_role` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `global_role` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `api_only` tinyint(1) NOT NULL DEFAULT '0', `mfa_enabled` tinyint(1) NOT NULL DEFAULT '0', `settings` json NOT NULL DEFAULT (json_object()),