2021-08-20 15:27:41 +00:00
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` activities ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
2024-06-18 20:37:08 +00:00
` created_at ` timestamp ( 6 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 6 ) ,
2021-08-20 15:27:41 +00:00
` user_id ` int ( 10 ) unsigned DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` user_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` activity_type ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
` details ` json DEFAULT NULL ,
2022-12-23 22:04:13 +00:00
` streamed ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
2023-11-09 20:50:01 +00:00
` user_email ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
KEY ` fk_activities_user_id ` ( ` user_id ` ) ,
2022-12-23 22:04:13 +00:00
KEY ` activities_streamed_idx ` ( ` streamed ` ) ,
2023-05-25 19:50:36 +00:00
KEY ` activities_created_at_idx ` ( ` created_at ` ) ,
2021-08-20 15:27:41 +00:00
CONSTRAINT ` activities_ibfk_1 ` FOREIGN KEY ( ` user_id ` ) REFERENCES ` users ` ( ` id ` ) ON DELETE SET NULL
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-10-20 21:35:38 +00:00
CREATE TABLE ` aggregated_stats ` (
2022-01-26 14:47:56 +00:00
` id ` bigint ( 20 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` type ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-10-20 21:35:38 +00:00
` json_value ` json NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2023-03-14 21:01:16 +00:00
` global_stats ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
PRIMARY KEY ( ` id ` , ` type ` , ` global_stats ` ) ,
2022-01-26 14:47:56 +00:00
KEY ` idx_aggregated_stats_updated_at ` ( ` updated_at ` ) ,
KEY ` aggregated_stats_type_idx ` ( ` type ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-10-20 21:35:38 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` app_config_json ` (
` id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 1 ' ,
` json_value ` json NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` id ` ( ` id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
2024-06-14 15:24:01 +00:00
INSERT INTO ` app_config_json ` VALUES ( 1 , ' {\"mdm\": {\"macos_setup\": {\"bootstrap_package\": null, \"macos_setup_assistant\": null, \"enable_end_user_authentication\": false, \"enable_release_device_manually\": false}, \"macos_updates\": {\"deadline\": null, \"minimum_version\": null}, \"macos_settings\": {\"custom_settings\": null}, \"macos_migration\": {\"mode\": \"\", \"enable\": false, \"webhook_url\": \"\"}, \"windows_updates\": {\"deadline_days\": null, \"grace_period_days\": null}, \"windows_settings\": {\"custom_settings\": null}, \"apple_bm_default_team\": \"\", \"apple_bm_terms_expired\": false, \"enable_disk_encryption\": false, \"enabled_and_configured\": false, \"end_user_authentication\": {\"idp_name\": \"\", \"metadata\": \"\", \"entity_id\": \"\", \"issuer_uri\": \"\", \"metadata_url\": \"\"}, \"windows_enabled_and_configured\": false, \"apple_bm_enabled_and_configured\": false}, \"scripts\": null, \"features\": {\"enable_host_users\": true, \"enable_software_inventory\": false}, \"org_info\": {\"org_name\": \"\", \"contact_url\": \"\", \"org_logo_url\": \"\", \"org_logo_url_light_background\": \"\"}, \"integrations\": {\"jira\": null, \"zendesk\": null, \"google_calendar\": null}, \"sso_settings\": {\"idp_name\": \"\", \"metadata\": \"\", \"entity_id\": \"\", \"enable_sso\": false, \"issuer_uri\": \"\", \"metadata_url\": \"\", \"idp_image_url\": \"\", \"enable_jit_role_sync\": false, \"enable_sso_idp_login\": false, \"enable_jit_provisioning\": false}, \"agent_options\": {\"config\": {\"options\": {\"logger_plugin\": \"tls\", \"pack_delimiter\": \"/\", \"logger_tls_period\": 10, \"distributed_plugin\": \"tls\", \"disable_distributed\": false, \"logger_tls_endpoint\": \"/api/osquery/log\", \"distributed_interval\": 10, \"distributed_tls_max_attempts\": 3}, \"decorators\": {\"load\": [\"SELECT uuid AS host_uuid FROM system_info;\", \"SELECT hostname AS hostname FROM system_info;\"]}}, \"overrides\": {}}, \"fleet_desktop\": {\"transparency_url\": \"\"}, \"smtp_settings\": {\"port\": 587, \"domain\": \"\", \"server\": \"\", \"password\": \"\", \"user_name\": \"\", \"configured\": false, \"enable_smtp\": false, \"enable_ssl_tls\": true, \"sender_address\": \"\", \"enable_start_tls\": true, \"verify_ssl_certs\": true, \"authentication_type\": \"0\", \"authentication_method\": \"0\"}, \"server_settings\": {\"server_url\": \"\", \"enable_analytics\": false, \"query_report_cap\": 0, \"scripts_disabled\": false, \"deferred_save_host\": false, \"live_query_disabled\": false, \"ai_features_disabled\": false, \"query_reports_disabled\": false}, \"webhook_settings\": {\"interval\": \"0s\", \"activities_webhook\": {\"destination_url\": \"\", \"enable_activities_webhook\": false}, \"host_status_webhook\": {\"days_count\": 0, \"destination_url\": \"\", \"host_percentage\": 0, \"enable_host_status_webhook\": false}, \"vulnerabilities_webhook\": {\"destination_url\": \"\", \"host_batch_size\": 0, \"enable_vulnerabilities_webhook\": false}, \"failing_policies_webhook\": {\"policy_ids\": null, \"destination_url\": \"\", \"host_batch_size\": 0, \"enable_failing_policies_webhook\": false}}, \"host_expiry_settings\": {\"host_expiry_window\": 0, \"host_expiry_enabled\": false}, \"vulnerability_settings\": {\"databases_path\": \"\"}, \"activity_expiry_settings\": {\"activity_expiry_window\": 0, \"activity_expiry_enabled\": false}} ' , ' 2020-01-01 01:01:01 ' , ' 2020-01-01 01:01:01 ' ) ;
2021-08-20 15:27:41 +00:00
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-03-15 00:15:35 +00:00
CREATE TABLE ` calendar_events ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` email ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` start_time ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` end_time ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` event ` json NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2024-03-21 15:23:59 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_one_calendar_event_per_email ` ( ` email ` )
2024-03-15 00:15:35 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
2021-08-20 15:27:41 +00:00
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` carve_blocks ` (
` metadata_id ` int ( 10 ) unsigned NOT NULL ,
` block_id ` int ( 11 ) NOT NULL ,
` data ` longblob ,
PRIMARY KEY ( ` metadata_id ` , ` block_id ` ) ,
CONSTRAINT ` carve_blocks_ibfk_1 ` FOREIGN KEY ( ` metadata_id ` ) REFERENCES ` carve_metadata ` ( ` id ` ) ON DELETE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` carve_metadata ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` host_id ` int ( 10 ) unsigned NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2021-08-20 15:27:41 +00:00
` block_count ` int ( 10 ) unsigned NOT NULL ,
` block_size ` int ( 10 ) unsigned NOT NULL ,
` carve_size ` bigint ( 20 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` carve_id ` varchar ( 64 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` request_id ` varchar ( 64 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` session_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
` expired ` tinyint ( 4 ) DEFAULT ' 0 ' ,
` max_block ` int ( 11 ) DEFAULT ' -1 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` error ` text COLLATE utf8mb4_unicode_ci ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_session_id ` ( ` session_id ` ) ,
UNIQUE KEY ` idx_name ` ( ` name ` ) ,
KEY ` host_id ` ( ` host_id ` ) ,
CONSTRAINT ` carve_metadata_ibfk_1 ` FOREIGN KEY ( ` host_id ` ) REFERENCES ` hosts ` ( ` id ` ) ON DELETE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-11-16 21:14:38 +00:00
CREATE TABLE ` cron_stats ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` instance ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` stats_type ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` status ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-11-16 21:14:38 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
KEY ` idx_cron_stats_name_created_at ` ( ` name ` , ` created_at ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-11-16 21:14:38 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-06-01 16:06:57 +00:00
CREATE TABLE ` cve_meta ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` cve ` varchar ( 20 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-05-20 16:58:40 +00:00
` cvss_score ` double DEFAULT NULL ,
` epss_probability ` double DEFAULT NULL ,
` cisa_known_exploit ` tinyint ( 1 ) DEFAULT NULL ,
2022-06-07 20:00:09 +00:00
` published ` timestamp NULL DEFAULT NULL ,
2023-09-15 17:24:10 +00:00
` description ` text COLLATE utf8mb4_unicode_ci ,
2022-05-20 16:58:40 +00:00
PRIMARY KEY ( ` cve ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-05-20 16:58:40 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` distributed_query_campaign_targets ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` type ` int ( 11 ) DEFAULT NULL ,
` distributed_query_campaign_id ` int ( 10 ) unsigned DEFAULT NULL ,
` target_id ` int ( 10 ) unsigned DEFAULT NULL ,
PRIMARY KEY ( ` id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` distributed_query_campaigns ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` query_id ` int ( 10 ) unsigned DEFAULT NULL ,
` status ` int ( 11 ) DEFAULT NULL ,
` user_id ` int ( 10 ) unsigned DEFAULT NULL ,
PRIMARY KEY ( ` id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` email_changes ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` user_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` token ` varchar ( 128 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` new_email ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_unique_email_changes_token ` ( ` token ` ) USING BTREE ,
KEY ` fk_email_changes_users ` ( ` user_id ` ) ,
CONSTRAINT ` fk_email_changes_users ` FOREIGN KEY ( ` user_id ` ) REFERENCES ` users ` ( ` id ` ) ON DELETE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` enroll_secrets ` (
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
2021-09-13 17:20:31 +00:00
` secret ` varchar ( 255 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL ,
2021-08-20 15:27:41 +00:00
` team_id ` int ( 10 ) unsigned DEFAULT NULL ,
2021-09-13 17:20:31 +00:00
PRIMARY KEY ( ` secret ` ) ,
2021-08-20 15:27:41 +00:00
KEY ` fk_enroll_secrets_team_id ` ( ` team_id ` ) ,
CONSTRAINT ` enroll_secrets_ibfk_1 ` FOREIGN KEY ( ` team_id ` ) REFERENCES ` teams ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-05-02 13:09:33 +00:00
CREATE TABLE ` eulas ` (
` id ` int ( 10 ) unsigned NOT NULL ,
` token ` varchar ( 36 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` bytes ` longblob ,
` created_at ` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-01-29 14:37:54 +00:00
CREATE TABLE ` host_activities ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` activity_id ` int ( 10 ) unsigned NOT NULL ,
PRIMARY KEY ( ` host_id ` , ` activity_id ` ) ,
KEY ` fk_host_activities_activity_id ` ( ` activity_id ` ) ,
CONSTRAINT ` host_activities_ibfk_1 ` FOREIGN KEY ( ` activity_id ` ) REFERENCES ` activities ` ( ` id ` ) ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` host_additional ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` additional ` json DEFAULT NULL ,
2022-01-12 17:07:51 +00:00
PRIMARY KEY ( ` host_id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-06-28 18:11:49 +00:00
CREATE TABLE ` host_batteries ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` host_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` serial_number ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-06-28 18:11:49 +00:00
` cycle_count ` int ( 10 ) NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` health ` varchar ( 40 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-06-28 18:11:49 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_host_batteries_host_id_serial_number ` ( ` host_id ` , ` serial_number ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-06-28 18:11:49 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-03-15 00:15:35 +00:00
CREATE TABLE ` host_calendar_events ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` host_id ` int ( 10 ) unsigned NOT NULL ,
` calendar_event_id ` int ( 10 ) unsigned NOT NULL ,
` webhook_status ` tinyint ( 4 ) NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_one_calendar_event_per_host ` ( ` host_id ` ) ,
KEY ` calendar_event_id ` ( ` calendar_event_id ` ) ,
CONSTRAINT ` host_calendar_events_ibfk_1 ` FOREIGN KEY ( ` calendar_event_id ` ) REFERENCES ` calendar_events ` ( ` id ` ) ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-05-23 18:01:04 +00:00
CREATE TABLE ` host_dep_assignments ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` added_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` deleted_at ` timestamp NULL DEFAULT NULL ,
2024-03-01 16:52:19 +00:00
` profile_uuid ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` assign_profile_response ` varchar ( 15 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` response_updated_at ` timestamp NULL DEFAULT NULL ,
` retry_job_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
PRIMARY KEY ( ` host_id ` ) ,
KEY ` idx_hdep_response ` ( ` assign_profile_response ` , ` response_updated_at ` )
2023-05-23 18:01:04 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-03-08 12:05:53 +00:00
CREATE TABLE ` host_device_auth ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` token ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-10 20:15:35 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2022-03-08 12:05:53 +00:00
PRIMARY KEY ( ` host_id ` ) ,
2022-03-09 21:13:56 +00:00
UNIQUE KEY ` idx_host_device_auth_token ` ( ` token ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-03-08 12:05:53 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-02-08 14:49:42 +00:00
CREATE TABLE ` host_disk_encryption_keys ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` base64_encrypted ` text COLLATE utf8mb4_unicode_ci NOT NULL ,
2023-02-08 14:49:42 +00:00
` decryptable ` tinyint ( 1 ) DEFAULT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2023-03-20 19:14:07 +00:00
` reset_requested ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
2023-09-18 15:14:24 +00:00
` client_error ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-02-08 14:49:42 +00:00
PRIMARY KEY ( ` host_id ` ) ,
KEY ` idx_host_disk_encryption_keys_decryptable ` ( ` decryptable ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2023-02-08 14:49:42 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-09-21 19:16:31 +00:00
CREATE TABLE ` host_disks ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` gigs_disk_space_available ` decimal ( 10 , 2 ) NOT NULL DEFAULT ' 0.00 ' ,
` percent_disk_space_available ` decimal ( 10 , 2 ) NOT NULL DEFAULT ' 0.00 ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2022-11-02 19:44:02 +00:00
` encrypted ` tinyint ( 1 ) DEFAULT NULL ,
2023-12-21 18:13:04 +00:00
` gigs_total_disk_space ` decimal ( 10 , 2 ) NOT NULL DEFAULT ' 0.00 ' ,
2022-09-21 19:16:31 +00:00
PRIMARY KEY ( ` host_id ` ) ,
KEY ` idx_host_disks_gigs_disk_space_available ` ( ` gigs_disk_space_available ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-09-21 19:16:31 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-10-08 12:57:46 +00:00
CREATE TABLE ` host_display_names ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` display_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-08 12:57:46 +00:00
PRIMARY KEY ( ` host_id ` ) ,
KEY ` display_name ` ( ` display_name ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-08 12:57:46 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-12-21 20:36:19 +00:00
CREATE TABLE ` host_emails ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` host_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` email ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` source ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-12-21 20:36:19 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
KEY ` idx_host_emails_host_id_email ` ( ` host_id ` , ` email ` ) ,
KEY ` idx_host_emails_email ` ( ` email ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-12-21 20:36:19 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-06-17 17:15:42 +00:00
CREATE TABLE ` host_issues ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` failing_policies_count ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` critical_vulnerabilities_count ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` total_issues_count ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` created_at ` timestamp ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ,
` updated_at ` timestamp ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) ,
PRIMARY KEY ( ` host_id ` ) ,
KEY ` total_issues_count ` ( ` total_issues_count ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-12-21 12:37:58 +00:00
CREATE TABLE ` host_mdm ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` enrolled ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` server_url ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-12-21 12:37:58 +00:00
` installed_from_dep ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
2022-08-10 19:15:01 +00:00
` mdm_id ` int ( 10 ) unsigned DEFAULT NULL ,
2022-11-08 09:29:40 +00:00
` is_server ` tinyint ( 1 ) DEFAULT NULL ,
2023-12-07 18:36:32 +00:00
` fleet_enroll_ref ` varchar ( 36 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2022-08-10 19:15:01 +00:00
PRIMARY KEY ( ` host_id ` ) ,
KEY ` host_mdm_mdm_id_idx ` ( ` mdm_id ` ) ,
KEY ` host_mdm_enrolled_installed_from_dep_idx ` ( ` enrolled ` , ` installed_from_dep ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-12-21 12:37:58 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-02-05 18:45:27 +00:00
CREATE TABLE ` host_mdm_actions ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` lock_ref ` varchar ( 36 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` wipe_ref ` varchar ( 36 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2024-02-13 18:03:53 +00:00
` unlock_pin ` varchar ( 6 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` unlock_ref ` varchar ( 36 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2024-02-26 21:52:23 +00:00
` fleet_platform ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2024-02-05 18:45:27 +00:00
PRIMARY KEY ( ` host_id ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-04-22 15:23:38 +00:00
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 ,
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
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-03-14 21:08:19 +00:00
CREATE TABLE ` host_mdm_apple_declarations ` (
` host_uuid ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` status ` varchar ( 20 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` operation_type ` varchar ( 20 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` detail ` text COLLATE utf8mb4_unicode_ci ,
2024-03-21 16:12:32 +00:00
` checksum ` binary ( 16 ) NOT NULL ,
2024-03-14 21:08:19 +00:00
` declaration_uuid ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2024-03-21 16:12:32 +00:00
` declaration_identifier ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` declaration_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2024-03-14 21:08:19 +00:00
PRIMARY KEY ( ` host_uuid ` , ` declaration_uuid ` ) ,
KEY ` status ` ( ` status ` ) ,
KEY ` operation_type ` ( ` operation_type ` ) ,
CONSTRAINT ` host_mdm_apple_declarations_ibfk_1 ` FOREIGN KEY ( ` status ` ) REFERENCES ` mdm_delivery_status ` ( ` status ` ) ON UPDATE CASCADE ,
CONSTRAINT ` host_mdm_apple_declarations_ibfk_2 ` FOREIGN KEY ( ` operation_type ` ) REFERENCES ` mdm_operation_types ` ( ` operation_type ` ) ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-02-22 17:49:06 +00:00
CREATE TABLE ` host_mdm_apple_profiles ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` profile_identifier ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` host_uuid ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` status ` varchar ( 20 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` operation_type ` varchar ( 20 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` detail ` text COLLATE utf8mb4_unicode_ci ,
` command_uuid ` varchar ( 127 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` profile_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-04-09 02:23:36 +00:00
` checksum ` binary ( 16 ) NOT NULL ,
2023-09-12 14:59:47 +00:00
` retries ` tinyint ( 3 ) unsigned NOT NULL DEFAULT ' 0 ' ,
2023-12-04 15:04:06 +00:00
` profile_uuid ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
PRIMARY KEY ( ` host_uuid ` , ` profile_uuid ` ) ,
2023-02-22 17:49:06 +00:00
KEY ` status ` ( ` status ` ) ,
KEY ` operation_type ` ( ` operation_type ` ) ,
2023-11-07 14:28:43 +00:00
CONSTRAINT ` host_mdm_apple_profiles_ibfk_1 ` FOREIGN KEY ( ` status ` ) REFERENCES ` mdm_delivery_status ` ( ` status ` ) ON UPDATE CASCADE ,
CONSTRAINT ` host_mdm_apple_profiles_ibfk_2 ` FOREIGN KEY ( ` operation_type ` ) REFERENCES ` mdm_operation_types ` ( ` operation_type ` ) ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` host_mdm_windows_profiles ` (
` host_uuid ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` status ` varchar ( 20 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` 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 ' ' ,
` retries ` tinyint ( 3 ) unsigned NOT NULL DEFAULT ' 0 ' ,
2023-12-04 15:04:06 +00:00
` profile_uuid ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-11-07 21:35:28 +00:00
PRIMARY KEY ( ` host_uuid ` , ` profile_uuid ` ) ,
2023-11-07 14:28:43 +00:00
KEY ` status ` ( ` status ` ) ,
KEY ` operation_type ` ( ` operation_type ` ) ,
CONSTRAINT ` host_mdm_windows_profiles_ibfk_1 ` FOREIGN KEY ( ` status ` ) REFERENCES ` mdm_delivery_status ` ( ` status ` ) ON UPDATE CASCADE ,
CONSTRAINT ` host_mdm_windows_profiles_ibfk_2 ` FOREIGN KEY ( ` operation_type ` ) REFERENCES ` mdm_operation_types ` ( ` operation_type ` ) ON UPDATE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2023-02-22 17:49:06 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-12-21 12:37:58 +00:00
CREATE TABLE ` host_munki_info ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2022-02-15 19:29:14 +00:00
` deleted_at ` timestamp NULL DEFAULT NULL ,
2021-12-21 12:37:58 +00:00
PRIMARY KEY ( ` host_id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-12-21 12:37:58 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-08-29 18:40:16 +00:00
CREATE TABLE ` host_munki_issues ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` munki_issue_id ` int ( 10 ) unsigned NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` host_id ` , ` munki_issue_id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-08-29 18:40:16 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-08-09 18:34:41 +00:00
CREATE TABLE ` host_operating_system ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` os_id ` int ( 10 ) unsigned NOT NULL ,
PRIMARY KEY ( ` host_id ` ) ,
KEY ` idx_host_operating_system_id ` ( ` os_id ` ) ,
CONSTRAINT ` host_operating_system_ibfk_1 ` FOREIGN KEY ( ` os_id ` ) REFERENCES ` operating_systems ` ( ` id ` ) ON DELETE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-08-09 18:34:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-10-24 16:12:56 +00:00
CREATE TABLE ` host_orbit_info ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` version ` varchar ( 50 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2024-04-09 21:33:44 +00:00
` desktop_version ` varchar ( 50 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` scripts_enabled ` tinyint ( 1 ) DEFAULT NULL ,
2022-10-24 16:12:56 +00:00
PRIMARY KEY ( ` host_id ` ) ,
KEY ` idx_host_orbit_info_version ` ( ` version ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-24 16:12:56 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-08-21 18:47:19 +00:00
CREATE TABLE ` host_script_results ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` host_id ` int ( 10 ) unsigned NOT NULL ,
` execution_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` output ` text COLLATE utf8mb4_unicode_ci NOT NULL ,
` runtime ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` exit_code ` int ( 10 ) DEFAULT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2023-09-11 15:54:34 +00:00
` script_id ` int ( 10 ) unsigned DEFAULT NULL ,
2024-01-29 14:37:54 +00:00
` user_id ` int ( 10 ) unsigned DEFAULT NULL ,
` sync_request ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
2024-02-29 15:43:19 +00:00
` script_content_id ` int ( 10 ) unsigned DEFAULT NULL ,
2024-06-12 14:26:03 +00:00
` host_deleted_at ` timestamp NULL DEFAULT NULL ,
2023-08-21 18:47:19 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_host_script_results_execution_id ` ( ` execution_id ` ) ,
2023-09-11 15:54:34 +00:00
KEY ` idx_host_script_results_host_exit_created ` ( ` host_id ` , ` exit_code ` , ` created_at ` ) ,
KEY ` fk_host_script_results_script_id ` ( ` script_id ` ) ,
2023-10-10 22:00:45 +00:00
KEY ` idx_host_script_created_at ` ( ` host_id ` , ` script_id ` , ` created_at ` ) ,
2024-01-29 14:37:54 +00:00
KEY ` fk_host_script_results_user_id ` ( ` user_id ` ) ,
2024-02-29 15:43:19 +00:00
KEY ` script_content_id ` ( ` script_content_id ` ) ,
2024-01-29 14:37:54 +00:00
CONSTRAINT ` fk_host_script_results_script_id ` FOREIGN KEY ( ` script_id ` ) REFERENCES ` scripts ` ( ` id ` ) ON DELETE SET NULL ,
2024-02-29 15:43:19 +00:00
CONSTRAINT ` fk_host_script_results_user_id ` FOREIGN KEY ( ` user_id ` ) REFERENCES ` users ` ( ` id ` ) ON DELETE SET NULL ,
CONSTRAINT ` host_script_results_ibfk_1 ` FOREIGN KEY ( ` script_content_id ` ) REFERENCES ` script_contents ` ( ` id ` ) ON DELETE CASCADE
2023-08-21 18:47:19 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-11-08 14:42:37 +00:00
CREATE TABLE ` host_seen_times ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` seen_time ` timestamp NULL DEFAULT NULL ,
PRIMARY KEY ( ` host_id ` ) ,
KEY ` idx_host_seen_times_seen_time ` ( ` seen_time ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-11-08 14:42:37 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` host_software ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` software_id ` bigint ( 20 ) unsigned NOT NULL ,
2022-04-26 18:16:59 +00:00
` last_opened_at ` timestamp NULL DEFAULT NULL ,
2021-08-20 17:57:37 +00:00
PRIMARY KEY ( ` host_id ` , ` software_id ` ) ,
2021-11-08 14:42:37 +00:00
KEY ` host_software_software_fk ` ( ` software_id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-05-17 18:49:09 +00:00
CREATE TABLE ` host_software_installed_paths ` (
` id ` bigint ( 20 ) unsigned NOT NULL AUTO_INCREMENT ,
` host_id ` int ( 10 ) unsigned NOT NULL ,
` software_id ` bigint ( 20 ) unsigned NOT NULL ,
` installed_path ` text COLLATE utf8mb4_unicode_ci NOT NULL ,
PRIMARY KEY ( ` id ` ) ,
KEY ` host_id_software_id_idx ` ( ` host_id ` , ` software_id ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-04-25 11:48:44 +00:00
CREATE TABLE ` host_software_installs ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` execution_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` host_id ` int ( 10 ) unsigned NOT NULL ,
` software_installer_id ` int ( 10 ) unsigned NOT NULL ,
` pre_install_query_output ` text COLLATE utf8mb4_unicode_ci ,
` install_script_output ` text COLLATE utf8mb4_unicode_ci ,
` install_script_exit_code ` int ( 10 ) DEFAULT NULL ,
` post_install_script_output ` text COLLATE utf8mb4_unicode_ci ,
` post_install_script_exit_code ` int ( 10 ) DEFAULT NULL ,
2024-05-07 15:28:16 +00:00
` user_id ` int ( 10 ) unsigned DEFAULT NULL ,
2024-04-25 11:48:44 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
2024-04-29 17:22:59 +00:00
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2024-05-21 14:13:12 +00:00
` self_service ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
2024-04-25 11:48:44 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_host_software_installs_execution_id ` ( ` execution_id ` ) ,
KEY ` fk_host_software_installs_installer_id ` ( ` software_installer_id ` ) ,
2024-05-07 15:28:16 +00:00
KEY ` fk_host_software_installs_user_id ` ( ` user_id ` ) ,
2024-05-01 18:37:52 +00:00
KEY ` idx_host_software_installs_host_installer ` ( ` host_id ` , ` software_installer_id ` ) ,
2024-05-07 15:28:16 +00:00
CONSTRAINT ` fk_host_software_installs_installer_id ` FOREIGN KEY ( ` software_installer_id ` ) REFERENCES ` software_installers ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` fk_host_software_installs_user_id ` FOREIGN KEY ( ` user_id ` ) REFERENCES ` users ` ( ` id ` ) ON DELETE SET NULL
2024-04-25 11:48:44 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-01-09 11:55:43 +00:00
CREATE TABLE ` host_updates ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` software_updated_at ` timestamp NULL DEFAULT NULL ,
PRIMARY KEY ( ` host_id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2023-01-09 11:55:43 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` host_users ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` uid ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` username ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` groupname ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2021-08-20 15:27:41 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` removed_at ` timestamp NULL DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` user_type ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` shell ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT ' ' ,
2021-09-07 14:02:35 +00:00
PRIMARY KEY ( ` host_id ` , ` uid ` , ` username ` ) ,
2022-01-12 17:07:51 +00:00
UNIQUE KEY ` idx_uid_username ` ( ` host_id ` , ` uid ` , ` username ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` hosts ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` osquery_host_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2021-08-20 15:27:41 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` detail_updated_at ` timestamp NULL DEFAULT NULL ,
` node_key ` varchar ( 255 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` hostname ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` uuid ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` platform ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` osquery_version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` os_version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` build ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` platform_like ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` code_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` uptime ` bigint ( 20 ) NOT NULL DEFAULT ' 0 ' ,
` memory ` bigint ( 20 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` cpu_type ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` cpu_subtype ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` cpu_brand ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` cpu_physical_cores ` int ( 11 ) NOT NULL DEFAULT ' 0 ' ,
` cpu_logical_cores ` int ( 11 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` hardware_vendor ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` hardware_model ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` hardware_version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` hardware_serial ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` computer_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` primary_ip_id ` int ( 10 ) unsigned DEFAULT NULL ,
` distributed_interval ` int ( 11 ) DEFAULT ' 0 ' ,
` logger_tls_period ` int ( 11 ) DEFAULT ' 0 ' ,
` config_tls_refresh ` int ( 11 ) DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` primary_ip ` varchar ( 45 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` primary_mac ` varchar ( 17 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` label_updated_at ` timestamp NOT NULL DEFAULT ' 2000-01-01 00:00:00 ' ,
` last_enrolled_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` refetch_requested ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
` team_id ` int ( 10 ) unsigned DEFAULT NULL ,
2021-09-27 19:27:38 +00:00
` policy_updated_at ` timestamp NOT NULL DEFAULT ' 2000-01-01 00:00:00 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` public_ip ` varchar ( 45 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2022-09-23 19:00:23 +00:00
` orbit_node_key ` varchar ( 255 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ,
2023-05-17 19:52:45 +00:00
` refetch_critical_queries_until ` timestamp NULL DEFAULT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_osquery_host_id ` ( ` osquery_host_id ` ) ,
UNIQUE KEY ` idx_host_unique_nodekey ` ( ` node_key ` ) ,
2022-09-27 20:55:07 +00:00
UNIQUE KEY ` idx_host_unique_orbitnodekey ` ( ` orbit_node_key ` ) ,
2021-08-20 15:27:41 +00:00
KEY ` fk_hosts_team_id ` ( ` team_id ` ) ,
2022-06-08 01:09:47 +00:00
KEY ` hosts_platform_idx ` ( ` platform ` ) ,
2022-12-26 21:32:39 +00:00
KEY ` idx_hosts_hardware_serial ` ( ` hardware_serial ` ) ,
2021-08-20 15:27:41 +00:00
FULLTEXT KEY ` host_ip_mac_search ` ( ` primary_ip ` , ` primary_mac ` ) ,
2022-10-08 12:57:46 +00:00
FULLTEXT KEY ` hosts_search ` ( ` hostname ` , ` uuid ` , ` computer_name ` ) ,
2021-08-20 15:27:41 +00:00
CONSTRAINT ` hosts_ibfk_1 ` FOREIGN KEY ( ` team_id ` ) REFERENCES ` teams ` ( ` id ` ) ON DELETE SET NULL
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` invite_teams ` (
` invite_id ` int ( 10 ) unsigned NOT NULL ,
` team_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` role ` varchar ( 64 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` invite_id ` , ` team_id ` ) ,
KEY ` fk_team_id ` ( ` team_id ` ) ,
CONSTRAINT ` invite_teams_ibfk_1 ` FOREIGN KEY ( ` invite_id ` ) REFERENCES ` invites ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` invite_teams_ibfk_2 ` FOREIGN KEY ( ` team_id ` ) REFERENCES ` teams ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` invites ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` invited_by ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` email ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` position ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` token ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
` sso_enabled ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` global_role ` varchar ( 64 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_invite_unique_email ` ( ` email ` ) ,
UNIQUE KEY ` idx_invite_unique_key ` ( ` token ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-04-05 16:56:15 +00:00
CREATE TABLE ` jobs ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-04-05 16:56:15 +00:00
` args ` json DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` state ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-04-05 16:56:15 +00:00
` retries ` int ( 11 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` error ` text COLLATE utf8mb4_unicode_ci ,
2023-05-03 20:25:36 +00:00
` not_before ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
2022-04-05 16:56:15 +00:00
PRIMARY KEY ( ` id ` )
2024-03-25 17:25:29 +00:00
) ENGINE = InnoDB AUTO_INCREMENT = 2 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-04-05 16:56:15 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
2024-03-25 17:25:29 +00:00
INSERT INTO ` jobs ` VALUES ( 1 , ' 2024-03-20 00:00:00 ' , ' 2024-03-20 00:00:00 ' , ' macos_setup_assistant ' , ' {\"task\": \"update_all_profiles\"} ' , ' queued ' , 0 , ' ' , ' 2024-03-20 00:00:00 ' ) ;
2022-04-05 16:56:15 +00:00
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` label_membership ` (
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` label_id ` int ( 10 ) unsigned NOT NULL ,
` host_id ` int ( 10 ) unsigned NOT NULL ,
PRIMARY KEY ( ` host_id ` , ` label_id ` ) ,
2021-09-21 14:48:20 +00:00
KEY ` idx_lm_label_id ` ( ` label_id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` labels ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` description ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` query ` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL ,
` platform ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2021-08-20 15:27:41 +00:00
` label_type ` int ( 10 ) unsigned NOT NULL DEFAULT ' 1 ' ,
` label_membership_type ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_label_unique_name ` ( ` name ` ) ,
FULLTEXT KEY ` labels_search ` ( ` name ` )
2024-04-03 18:13:10 +00:00
) ENGINE = InnoDB AUTO_INCREMENT = 2 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
2024-04-03 18:15:06 +00:00
INSERT INTO ` labels ` VALUES ( 1 , ' 2024-04-03 00:00:00 ' , ' 2024-04-03 00:00:00 ' , ' macOS 14+ (Sonoma+) ' , ' macOS hosts with version 14 and above ' , ' select 1 from os_version where platform = \ ' darwin \ ' and major >= 14; ' , ' darwin ' , 1 , 0 ) ;
2021-08-20 15:27:41 +00:00
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` locks ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` owner ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2021-08-20 15:27:41 +00:00
` expires_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_name ` ( ` name ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB AUTO_INCREMENT = 2 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-04-07 20:31:02 +00:00
CREATE TABLE ` mdm_apple_bootstrap_packages ` (
` team_id ` int ( 10 ) unsigned NOT NULL ,
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` sha256 ` binary ( 32 ) NOT NULL ,
` bytes ` longblob ,
` token ` varchar ( 36 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2023-04-22 15:23:38 +00:00
` created_at ` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2023-04-07 20:31:02 +00:00
PRIMARY KEY ( ` team_id ` ) ,
UNIQUE KEY ` idx_token ` ( ` token ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-02-09 00:36:20 +00:00
CREATE TABLE ` mdm_apple_configuration_profiles ` (
` profile_id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` team_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` identifier ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2024-06-18 17:02:00 +00:00
` mobileconfig ` mediumblob NOT NULL ,
2023-02-09 00:36:20 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
2024-02-05 15:01:38 +00:00
` uploaded_at ` timestamp NULL DEFAULT NULL ,
2023-04-09 02:23:36 +00:00
` checksum ` binary ( 16 ) NOT NULL ,
2023-12-04 15:04:06 +00:00
` profile_uuid ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
PRIMARY KEY ( ` profile_uuid ` ) ,
2023-02-09 00:36:20 +00:00
UNIQUE KEY ` idx_mdm_apple_config_prof_team_identifier ` ( ` team_id ` , ` identifier ` ) ,
2023-12-04 15:04:06 +00:00
UNIQUE KEY ` idx_mdm_apple_config_prof_team_name ` ( ` team_id ` , ` name ` ) ,
UNIQUE KEY ` idx_mdm_apple_config_prof_id ` ( ` profile_id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2023-02-09 00:36:20 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-03-14 21:08:19 +00:00
CREATE TABLE ` mdm_apple_declaration_activation_references ` (
` declaration_uuid ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` reference ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
PRIMARY KEY ( ` declaration_uuid ` , ` reference ` ) ,
KEY ` reference ` ( ` reference ` ) ,
CONSTRAINT ` mdm_apple_declaration_activation_references_ibfk_1 ` FOREIGN KEY ( ` declaration_uuid ` ) REFERENCES ` mdm_apple_declarations ` ( ` declaration_uuid ` ) ON UPDATE CASCADE ,
CONSTRAINT ` mdm_apple_declaration_activation_references_ibfk_2 ` FOREIGN KEY ( ` reference ` ) REFERENCES ` mdm_apple_declarations ` ( ` declaration_uuid ` ) ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` mdm_apple_declarations ` (
` declaration_uuid ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` team_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` identifier ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2024-03-21 16:12:32 +00:00
` raw_json ` json NOT NULL ,
` checksum ` binary ( 16 ) NOT NULL ,
2024-03-14 21:08:19 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` uploaded_at ` timestamp NULL DEFAULT NULL ,
PRIMARY KEY ( ` declaration_uuid ` ) ,
UNIQUE KEY ` idx_mdm_apple_declaration_team_identifier ` ( ` team_id ` , ` identifier ` ) ,
2024-03-25 20:32:27 +00:00
UNIQUE KEY ` idx_mdm_apple_declaration_team_name ` ( ` team_id ` , ` name ` )
2024-03-14 21:08:19 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-03-27 03:09:09 +00:00
CREATE TABLE ` mdm_apple_declarative_requests ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` enrollment_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` message_type ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` raw_json ` text COLLATE utf8mb4_unicode_ci ,
PRIMARY KEY ( ` id ` ) ,
KEY ` mdm_apple_declarative_requests_enrollment_id ` ( ` enrollment_id ` ) ,
CONSTRAINT ` mdm_apple_declarative_requests_enrollment_id ` FOREIGN KEY ( ` enrollment_id ` ) REFERENCES ` nano_enrollments ` ( ` id ` ) ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-05-17 13:06:14 +00:00
CREATE TABLE ` mdm_apple_default_setup_assistants ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` team_id ` int ( 10 ) unsigned DEFAULT NULL ,
` global_or_team_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` profile_uuid ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_mdm_default_setup_assistant_global_or_team_id ` ( ` global_or_team_id ` ) ,
KEY ` fk_mdm_default_setup_assistant_team_id ` ( ` team_id ` ) ,
CONSTRAINT ` mdm_apple_default_setup_assistants_ibfk_1 ` FOREIGN KEY ( ` team_id ` ) REFERENCES ` teams ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-10-05 22:53:54 +00:00
CREATE TABLE ` mdm_apple_enrollment_profiles ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` token ` varchar ( 36 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` type ` varchar ( 10 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' automatic ' ,
2022-10-05 22:53:54 +00:00
` dep_profile ` json DEFAULT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_type ` ( ` type ` ) ,
UNIQUE KEY ` idx_token ` ( ` token ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` mdm_apple_installers ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2022-10-05 22:53:54 +00:00
` size ` bigint ( 20 ) NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` manifest ` text COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-05 22:53:54 +00:00
` installer ` longblob ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` url_token ` varchar ( 36 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2022-10-05 22:53:54 +00:00
PRIMARY KEY ( ` id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-04-25 13:36:01 +00:00
CREATE TABLE ` mdm_apple_setup_assistants ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` team_id ` int ( 10 ) unsigned DEFAULT NULL ,
` global_or_team_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` name ` text COLLATE utf8mb4_unicode_ci NOT NULL ,
` profile ` json NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2023-05-03 20:25:36 +00:00
` profile_uuid ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-04-25 13:36:01 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_mdm_setup_assistant_global_or_team_id ` ( ` global_or_team_id ` ) ,
KEY ` fk_mdm_setup_assistant_team_id ` ( ` team_id ` ) ,
CONSTRAINT ` mdm_apple_setup_assistants_ibfk_1 ` FOREIGN KEY ( ` team_id ` ) REFERENCES ` teams ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-05-22 20:42:37 +00:00
CREATE TABLE ` mdm_config_assets ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` name ` varchar ( 256 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` value ` longblob NOT NULL ,
` deleted_at ` timestamp NULL DEFAULT NULL ,
` deletion_uuid ` varchar ( 127 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2024-05-30 21:18:42 +00:00
` md5_checksum ` binary ( 16 ) NOT NULL ,
2024-05-22 20:42:37 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_mdm_config_assets_name_deletion_uuid ` ( ` name ` , ` deletion_uuid ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-01-26 16:00:58 +00:00
CREATE TABLE ` mdm_configuration_profile_labels ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` apple_profile_uuid ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` windows_profile_uuid ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` label_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` label_id ` int ( 10 ) unsigned DEFAULT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_mdm_configuration_profile_labels_apple_label_name ` ( ` apple_profile_uuid ` , ` label_name ` ) ,
UNIQUE KEY ` idx_mdm_configuration_profile_labels_windows_label_name ` ( ` windows_profile_uuid ` , ` label_name ` ) ,
KEY ` label_id ` ( ` label_id ` ) ,
CONSTRAINT ` mdm_configuration_profile_labels_ibfk_1 ` FOREIGN KEY ( ` apple_profile_uuid ` ) REFERENCES ` mdm_apple_configuration_profiles ` ( ` profile_uuid ` ) ON DELETE CASCADE ,
CONSTRAINT ` mdm_configuration_profile_labels_ibfk_2 ` FOREIGN KEY ( ` windows_profile_uuid ` ) REFERENCES ` mdm_windows_configuration_profiles ` ( ` profile_uuid ` ) ON DELETE CASCADE ,
CONSTRAINT ` mdm_configuration_profile_labels_ibfk_3 ` FOREIGN KEY ( ` label_id ` ) REFERENCES ` labels ` ( ` id ` ) ON DELETE SET NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-03-14 21:08:19 +00:00
CREATE TABLE ` mdm_declaration_labels ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
2024-03-21 16:12:32 +00:00
` apple_declaration_uuid ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2024-03-14 21:08:19 +00:00
` label_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` label_id ` int ( 10 ) unsigned DEFAULT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` uploaded_at ` timestamp NULL DEFAULT NULL ,
PRIMARY KEY ( ` id ` ) ,
2024-03-21 16:12:32 +00:00
UNIQUE KEY ` idx_mdm_declaration_labels_label_name ` ( ` apple_declaration_uuid ` , ` label_name ` ) ,
2024-03-14 21:08:19 +00:00
KEY ` label_id ` ( ` label_id ` ) ,
2024-03-21 16:12:32 +00:00
CONSTRAINT ` mdm_declaration_labels_ibfk_1 ` FOREIGN KEY ( ` apple_declaration_uuid ` ) REFERENCES ` mdm_apple_declarations ` ( ` declaration_uuid ` ) ON DELETE CASCADE ,
2024-03-14 21:08:19 +00:00
CONSTRAINT ` mdm_declaration_labels_ibfk_3 ` FOREIGN KEY ( ` label_id ` ) REFERENCES ` labels ` ( ` id ` ) ON DELETE SET NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-11-07 14:28:43 +00:00
CREATE TABLE ` mdm_delivery_status ` (
` status ` varchar ( 20 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
PRIMARY KEY ( ` status ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
INSERT INTO ` mdm_delivery_status ` VALUES ( ' failed ' ) , ( ' pending ' ) , ( ' verified ' ) , ( ' verifying ' ) ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-03-07 13:57:26 +00:00
CREATE TABLE ` mdm_idp_accounts ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` uuid ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` username ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2023-05-18 15:50:00 +00:00
` fullname ` varchar ( 256 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-08-23 21:23:26 +00:00
` email ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-10-27 15:42:30 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` uuid ` ) ,
UNIQUE KEY ` unique_idp_email ` ( ` email ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2023-03-07 13:57:26 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-11-07 14:28:43 +00:00
CREATE TABLE ` mdm_operation_types ` (
` operation_type ` varchar ( 20 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
PRIMARY KEY ( ` operation_type ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
INSERT INTO ` mdm_operation_types ` VALUES ( ' install ' ) , ( ' remove ' ) ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` mdm_windows_configuration_profiles ` (
` team_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` syncml ` mediumblob NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
2024-02-05 15:01:38 +00:00
` uploaded_at ` timestamp NULL DEFAULT NULL ,
2023-12-04 15:04:06 +00:00
` profile_uuid ` varchar ( 37 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-11-07 21:35:28 +00:00
PRIMARY KEY ( ` profile_uuid ` ) ,
2023-11-07 14:28:43 +00:00
UNIQUE KEY ` idx_mdm_windows_configuration_profiles_team_id_name ` ( ` team_id ` , ` name ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-07-05 13:06:37 +00:00
CREATE TABLE ` mdm_windows_enrollments ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` mdm_device_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` mdm_hardware_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` device_state ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` device_type ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` device_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` enroll_type ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` enroll_user_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` enroll_proto_version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` enroll_client_version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` not_in_oobe ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2023-11-01 14:13:12 +00:00
` host_uuid ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-07-05 13:06:37 +00:00
PRIMARY KEY ( ` id ` ) ,
2024-03-13 15:27:37 +00:00
UNIQUE KEY ` idx_type ` ( ` mdm_hardware_id ` ) ,
2024-06-14 18:01:12 +00:00
KEY ` idx_mdm_windows_enrollments_mdm_device_id ` ( ` mdm_device_id ` ) ,
KEY ` idx_mdm_windows_enrollments_host_uuid ` ( ` host_uuid ` )
2023-07-05 13:06:37 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` migration_status_tables ` (
` id ` bigint ( 20 ) unsigned NOT NULL AUTO_INCREMENT ,
` version_id ` bigint ( 20 ) NOT NULL ,
` is_applied ` tinyint ( 1 ) NOT NULL ,
` tstamp ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` id ` ( ` id ` )
2024-06-27 21:10:49 +00:00
) ENGINE = InnoDB AUTO_INCREMENT = 275 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-08-10 19:15:01 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
2024-06-27 21:10:49 +00:00
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 , ' 20
2022-08-10 19:15:01 +00:00
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` mobile_device_management_solutions ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 100 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` server_url ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-08-10 19:15:01 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_mobile_device_management_solutions_name ` ( ` name ` , ` server_url ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-08-29 18:40:16 +00:00
CREATE TABLE ` munki_issues ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` issue_type ` varchar ( 10 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-08-29 18:40:16 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_munki_issues_name ` ( ` name ` , ` issue_type ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-08-29 18:40:16 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-10-05 22:53:54 +00:00
CREATE TABLE ` nano_cert_auth_associations ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` sha256 ` char ( 64 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-05 22:53:54 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2024-02-22 22:24:11 +00:00
` cert_not_valid_after ` timestamp NULL DEFAULT NULL ,
` renew_command_uuid ` varchar ( 127 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
PRIMARY KEY ( ` id ` , ` sha256 ` ) ,
KEY ` renew_command_uuid_fk ` ( ` renew_command_uuid ` ) ,
CONSTRAINT ` renew_command_uuid_fk ` FOREIGN KEY ( ` renew_command_uuid ` ) REFERENCES ` nano_commands ` ( ` command_uuid ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` nano_command_results ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` command_uuid ` varchar ( 127 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` status ` varchar ( 31 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` result ` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-05 22:53:54 +00:00
` not_now_at ` timestamp NULL DEFAULT NULL ,
` not_now_tally ` int ( 11 ) NOT NULL DEFAULT ' 0 ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` , ` command_uuid ` ) ,
KEY ` command_uuid ` ( ` command_uuid ` ) ,
KEY ` status ` ( ` status ` ) ,
CONSTRAINT ` nano_command_results_ibfk_1 ` FOREIGN KEY ( ` id ` ) REFERENCES ` nano_enrollments ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` nano_command_results_ibfk_2 ` FOREIGN KEY ( ` command_uuid ` ) REFERENCES ` nano_commands ` ( ` command_uuid ` ) ON DELETE CASCADE ON UPDATE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` nano_commands ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` command_uuid ` varchar ( 127 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` request_type ` varchar ( 63 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` command ` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-05 22:53:54 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` command_uuid ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` nano_dep_names ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` consumer_key ` text COLLATE utf8mb4_unicode_ci ,
` consumer_secret ` text COLLATE utf8mb4_unicode_ci ,
` access_token ` text COLLATE utf8mb4_unicode_ci ,
` access_secret ` text COLLATE utf8mb4_unicode_ci ,
2022-10-05 22:53:54 +00:00
` access_token_expiry ` timestamp NULL DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` config_base_url ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` tokenpki_cert_pem ` text COLLATE utf8mb4_unicode_ci ,
` tokenpki_key_pem ` text COLLATE utf8mb4_unicode_ci ,
` syncer_cursor ` varchar ( 1024 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2022-10-05 22:53:54 +00:00
` syncer_cursor_at ` timestamp NULL DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` assigner_profile_uuid ` text COLLATE utf8mb4_unicode_ci ,
2022-10-05 22:53:54 +00:00
` assigner_profile_uuid_at ` timestamp NULL DEFAULT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` name ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` nano_devices ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` identity_cert ` text COLLATE utf8mb4_unicode_ci ,
` serial_number ` varchar ( 127 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2022-10-05 22:53:54 +00:00
` unlock_token ` mediumblob ,
` unlock_token_at ` timestamp NULL DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` authenticate ` text COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-05 22:53:54 +00:00
` authenticate_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` token_update ` text COLLATE utf8mb4_unicode_ci ,
2022-10-05 22:53:54 +00:00
` token_update_at ` timestamp NULL DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` bootstrap_token_b64 ` text COLLATE utf8mb4_unicode_ci ,
2022-10-05 22:53:54 +00:00
` bootstrap_token_at ` timestamp NULL DEFAULT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
KEY ` serial_number ` ( ` serial_number ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` nano_enrollment_queue ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` command_uuid ` varchar ( 127 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-05 22:53:54 +00:00
` active ` tinyint ( 1 ) NOT NULL DEFAULT ' 1 ' ,
` priority ` tinyint ( 4 ) NOT NULL DEFAULT ' 0 ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` , ` command_uuid ` ) ,
KEY ` command_uuid ` ( ` command_uuid ` ) ,
2023-08-21 14:07:57 +00:00
KEY ` priority ` ( ` priority ` , ` created_at ` ) ,
2022-10-05 22:53:54 +00:00
CONSTRAINT ` nano_enrollment_queue_ibfk_1 ` FOREIGN KEY ( ` id ` ) REFERENCES ` nano_enrollments ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` nano_enrollment_queue_ibfk_2 ` FOREIGN KEY ( ` command_uuid ` ) REFERENCES ` nano_commands ` ( ` command_uuid ` ) ON DELETE CASCADE ON UPDATE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` nano_enrollments ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` device_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` user_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` type ` varchar ( 31 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` topic ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` push_magic ` varchar ( 127 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` token_hex ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-05 22:53:54 +00:00
` enabled ` tinyint ( 1 ) NOT NULL DEFAULT ' 1 ' ,
` token_update_tally ` int ( 11 ) NOT NULL DEFAULT ' 1 ' ,
` last_seen_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` user_id ` ( ` user_id ` ) ,
KEY ` device_id ` ( ` device_id ` ) ,
KEY ` type ` ( ` type ` ) ,
CONSTRAINT ` nano_enrollments_ibfk_1 ` FOREIGN KEY ( ` device_id ` ) REFERENCES ` nano_devices ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` nano_enrollments_ibfk_2 ` FOREIGN KEY ( ` user_id ` ) REFERENCES ` nano_users ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` nano_push_certs ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` topic ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` cert_pem ` text COLLATE utf8mb4_unicode_ci NOT NULL ,
` key_pem ` text COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-05 22:53:54 +00:00
` stale_token ` int ( 11 ) NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` topic ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` nano_users ` (
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` device_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` user_short_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` user_long_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` token_update ` text COLLATE utf8mb4_unicode_ci ,
2022-10-05 22:53:54 +00:00
` token_update_at ` timestamp NULL DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` user_authenticate ` text COLLATE utf8mb4_unicode_ci ,
2022-10-05 22:53:54 +00:00
` user_authenticate_at ` timestamp NULL DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` user_authenticate_digest ` text COLLATE utf8mb4_unicode_ci ,
2022-10-05 22:53:54 +00:00
` user_authenticate_digest_at ` timestamp NULL DEFAULT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` , ` device_id ` ) ,
KEY ` device_id ` ( ` device_id ` ) ,
CONSTRAINT ` nano_users_ibfk_1 ` FOREIGN KEY ( ` device_id ` ) REFERENCES ` nano_devices ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
SET @ saved_cs_client = @ @ character_set_client ;
SET character_set_client = utf8 ;
/* !50001 CREATE VIEW `nano_view_queue` AS SELECT
1 AS ` id ` ,
1 AS ` created_at ` ,
1 AS ` active ` ,
1 AS ` priority ` ,
1 AS ` command_uuid ` ,
1 AS ` request_type ` ,
1 AS ` command ` ,
1 AS ` result_updated_at ` ,
1 AS ` status ` ,
1 AS ` result ` * / ;
SET character_set_client = @ saved_cs_client ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` network_interfaces ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` host_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` mac ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` ip_address ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` broadcast ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` ibytes ` bigint ( 20 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` interface ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` ipackets ` bigint ( 20 ) NOT NULL DEFAULT ' 0 ' ,
` last_change ` bigint ( 20 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` mask ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` metric ` int ( 11 ) NOT NULL DEFAULT ' 0 ' ,
` mtu ` int ( 11 ) NOT NULL DEFAULT ' 0 ' ,
` obytes ` bigint ( 20 ) NOT NULL DEFAULT ' 0 ' ,
` ierrors ` bigint ( 20 ) NOT NULL DEFAULT ' 0 ' ,
` oerrors ` bigint ( 20 ) NOT NULL DEFAULT ' 0 ' ,
` opackets ` bigint ( 20 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` point_to_point ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` type ` int ( 11 ) NOT NULL DEFAULT ' 0 ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_network_interfaces_unique_ip_host_intf ` ( ` ip_address ` , ` host_id ` , ` interface ` ) ,
KEY ` idx_network_interfaces_hosts_fk ` ( ` host_id ` ) ,
FULLTEXT KEY ` ip_address_search ` ( ` ip_address ` ) ,
CONSTRAINT ` network_interfaces_ibfk_1 ` FOREIGN KEY ( ` host_id ` ) REFERENCES ` hosts ` ( ` id ` ) ON DELETE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-10-28 15:12:21 +00:00
CREATE TABLE ` operating_system_vulnerabilities ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` operating_system_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` cve ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-28 15:12:21 +00:00
` source ` smallint ( 6 ) DEFAULT ' 0 ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
2024-01-24 19:18:57 +00:00
` resolved_in_version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2022-10-28 15:12:21 +00:00
PRIMARY KEY ( ` id ` ) ,
2024-01-24 19:18:57 +00:00
UNIQUE KEY ` idx_os_vulnerabilities_unq_os_id_cve ` ( ` operating_system_id ` , ` cve ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-28 15:12:21 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-08-09 18:34:41 +00:00
CREATE TABLE ` operating_systems ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` version ` varchar ( 150 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` arch ` varchar ( 150 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` kernel_version ` varchar ( 150 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` platform ` varchar ( 50 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2024-01-24 19:18:57 +00:00
` display_version ` varchar ( 10 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2024-01-31 17:14:24 +00:00
` os_version_id ` int ( 10 ) unsigned DEFAULT NULL ,
2022-08-09 18:34:41 +00:00
PRIMARY KEY ( ` id ` ) ,
2024-01-24 19:18:57 +00:00
UNIQUE KEY ` idx_unique_os ` ( ` name ` , ` version ` , ` arch ` , ` kernel_version ` , ` platform ` , ` display_version ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-08-09 18:34:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` osquery_options ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` override_type ` int ( 1 ) NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` override_identifier ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` options ` json NOT NULL ,
PRIMARY KEY ( ` id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB AUTO_INCREMENT = 2 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
INSERT INTO ` osquery_options ` VALUES ( 1 , 0 , ' ' , ' {\"options\": {\"logger_plugin\": \"tls\", \"pack_delimiter\": \"/\", \"logger_tls_period\": 10, \"distributed_plugin\": \"tls\", \"disable_distributed\": false, \"logger_tls_endpoint\": \"/api/v1/osquery/log\", \"distributed_interval\": 10, \"distributed_tls_max_attempts\": 3}, \"decorators\": {\"load\": [\"SELECT uuid AS host_uuid FROM system_info;\", \"SELECT hostname AS hostname FROM system_info;\"]}} ' ) ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` pack_targets ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` pack_id ` int ( 10 ) unsigned DEFAULT NULL ,
` type ` int ( 11 ) DEFAULT NULL ,
` target_id ` int ( 10 ) unsigned NOT NULL ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` constraint_pack_target_unique ` ( ` pack_id ` , ` target_id ` , ` type ` ) ,
CONSTRAINT ` pack_targets_ibfk_1 ` FOREIGN KEY ( ` pack_id ` ) REFERENCES ` packs ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` packs ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` disabled ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` description ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` platform ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` pack_type ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_pack_unique_name ` ( ` name ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` password_reset_requests ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` expires_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` user_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` token ` varchar ( 1024 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-24 20:24:52 +00:00
CREATE TABLE ` policies ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2021-09-20 14:00:57 +00:00
` team_id ` int ( 10 ) unsigned DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` resolution ` text COLLATE utf8mb4_unicode_ci ,
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` query ` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL ,
` description ` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-11-24 17:16:42 +00:00
` author_id ` int ( 10 ) unsigned DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` platforms ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2022-12-06 14:59:20 +00:00
` critical ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
2024-02-02 23:41:32 +00:00
` checksum ` binary ( 16 ) NOT NULL ,
2024-03-15 00:15:35 +00:00
` calendar_events_enabled ` tinyint ( 1 ) unsigned NOT NULL DEFAULT ' 0 ' ,
2021-08-24 20:24:52 +00:00
PRIMARY KEY ( ` id ` ) ,
2024-02-02 23:41:32 +00:00
UNIQUE KEY ` idx_policies_checksum ` ( ` checksum ` ) ,
2021-11-24 17:16:42 +00:00
KEY ` idx_policies_author_id ` ( ` author_id ` ) ,
KEY ` idx_policies_team_id ` ( ` team_id ` ) ,
CONSTRAINT ` policies_ibfk_2 ` FOREIGN KEY ( ` team_id ` ) REFERENCES ` teams ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` policies_queries_ibfk_1 ` FOREIGN KEY ( ` author_id ` ) REFERENCES ` users ` ( ` id ` ) ON DELETE SET NULL
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-24 20:24:52 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-12-16 21:00:54 +00:00
CREATE TABLE ` policy_automation_iterations ` (
` policy_id ` int ( 10 ) unsigned NOT NULL ,
` iteration ` int ( 11 ) NOT NULL ,
PRIMARY KEY ( ` policy_id ` ) ,
CONSTRAINT ` policy_automation_iterations_ibfk_1 ` FOREIGN KEY ( ` policy_id ` ) REFERENCES ` policies ` ( ` id ` ) ON DELETE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-12-16 21:00:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-12-03 16:10:11 +00:00
CREATE TABLE ` policy_membership ` (
` policy_id ` int ( 10 ) unsigned NOT NULL ,
2021-08-24 20:24:52 +00:00
` host_id ` int ( 10 ) unsigned NOT NULL ,
` passes ` tinyint ( 1 ) DEFAULT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2022-12-16 21:00:54 +00:00
` automation_iteration ` int ( 11 ) DEFAULT NULL ,
2021-12-03 16:10:11 +00:00
PRIMARY KEY ( ` policy_id ` , ` host_id ` ) ,
2021-08-24 20:24:52 +00:00
KEY ` idx_policy_membership_passes ` ( ` passes ` ) ,
KEY ` idx_policy_membership_policy_id ` ( ` policy_id ` ) ,
KEY ` idx_policy_membership_host_id_passes ` ( ` host_id ` , ` passes ` ) ,
2022-01-12 17:07:51 +00:00
CONSTRAINT ` policy_membership_ibfk_1 ` FOREIGN KEY ( ` policy_id ` ) REFERENCES ` policies ` ( ` id ` ) ON DELETE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-24 20:24:52 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-11-21 19:52:06 +00:00
CREATE TABLE ` policy_stats ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` policy_id ` int ( 10 ) unsigned NOT NULL ,
` inherited_team_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` passing_host_count ` mediumint ( 8 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` failing_host_count ` mediumint ( 8 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` policy_team_unique ` ( ` policy_id ` , ` inherited_team_id ` ) ,
CONSTRAINT ` policy_stats_ibfk_1 ` FOREIGN KEY ( ` policy_id ` ) REFERENCES ` policies ` ( ` id ` ) ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` queries ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` saved ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` description ` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL ,
` query ` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
` author_id ` int ( 10 ) unsigned DEFAULT NULL ,
` observer_can_run ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
2023-07-06 21:28:25 +00:00
` team_id ` int ( 10 ) unsigned DEFAULT NULL ,
2023-07-10 18:53:00 +00:00
` team_id_char ` char ( 10 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-07-10 17:22:51 +00:00
` platform ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` min_osquery_version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` schedule_interval ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` automations_enabled ` tinyint ( 1 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` logging_type ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' snapshot ' ,
2023-10-05 12:29:40 +00:00
` discard_data ` tinyint ( 1 ) NOT NULL DEFAULT ' 1 ' ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
2023-07-06 21:28:25 +00:00
UNIQUE KEY ` idx_team_id_name_unq ` ( ` team_id_char ` , ` name ` ) ,
2023-07-26 21:13:27 +00:00
UNIQUE KEY ` idx_name_team_id_unq ` ( ` name ` , ` team_id_char ` ) ,
2021-08-20 15:27:41 +00:00
KEY ` author_id ` ( ` author_id ` ) ,
2023-07-26 21:13:27 +00:00
KEY ` idx_team_id_saved_auto_interval ` ( ` team_id ` , ` saved ` , ` automations_enabled ` , ` schedule_interval ` ) ,
2023-07-06 21:28:25 +00:00
CONSTRAINT ` queries_ibfk_1 ` FOREIGN KEY ( ` author_id ` ) REFERENCES ` users ` ( ` id ` ) ON DELETE SET NULL ,
2023-07-10 18:53:00 +00:00
CONSTRAINT ` queries_ibfk_2 ` FOREIGN KEY ( ` team_id ` ) REFERENCES ` teams ` ( ` id ` ) ON DELETE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-10-05 02:56:17 +00:00
CREATE TABLE ` query_results ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` query_id ` int ( 10 ) unsigned NOT NULL ,
` host_id ` int ( 10 ) unsigned NOT NULL ,
` osquery_version ` varchar ( 50 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
` error ` text COLLATE utf8mb4_unicode_ci ,
` last_fetched ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` data ` json DEFAULT NULL ,
PRIMARY KEY ( ` id ` ) ,
2023-10-25 22:20:27 +00:00
KEY ` query_id ` ( ` query_id ` )
2023-10-05 02:56:17 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-10-05 22:53:54 +00:00
CREATE TABLE ` scep_certificates ` (
` serial ` bigint ( 20 ) NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 1024 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2022-10-05 22:53:54 +00:00
` not_valid_before ` datetime NOT NULL ,
` not_valid_after ` datetime NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` certificate_pem ` text COLLATE utf8mb4_unicode_ci NOT NULL ,
2022-10-05 22:53:54 +00:00
` revoked ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` serial ` ) ,
CONSTRAINT ` scep_certificates_ibfk_1 ` FOREIGN KEY ( ` serial ` ) REFERENCES ` scep_serials ` ( ` serial ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` scep_serials ` (
` serial ` bigint ( 20 ) NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` serial ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB AUTO_INCREMENT = 2 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-10-05 22:53:54 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` scheduled_queries ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` pack_id ` int ( 10 ) unsigned DEFAULT NULL ,
` query_id ` int ( 10 ) unsigned DEFAULT NULL ,
` interval ` int ( 10 ) unsigned DEFAULT NULL ,
` snapshot ` tinyint ( 1 ) DEFAULT NULL ,
` removed ` tinyint ( 1 ) DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` platform ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT ' ' ,
` version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` shard ` int ( 10 ) unsigned DEFAULT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` query_name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` description ` varchar ( 1023 ) COLLATE utf8mb4_unicode_ci DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` denylist ` tinyint ( 1 ) DEFAULT NULL ,
2023-07-10 18:56:44 +00:00
` team_id_char ` char ( 10 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` unique_names_in_packs ` ( ` name ` , ` pack_id ` ) ,
KEY ` scheduled_queries_pack_id ` ( ` pack_id ` ) ,
KEY ` scheduled_queries_query_name ` ( ` query_name ` ) ,
2023-07-10 18:53:00 +00:00
KEY ` fk_scheduled_queries_queries ` ( ` team_id_char ` , ` query_name ` ) ,
2023-07-10 20:01:46 +00:00
CONSTRAINT ` scheduled_queries_ibfk_1 ` FOREIGN KEY ( ` team_id_char ` , ` query_name ` ) REFERENCES ` queries ` ( ` team_id_char ` , ` name ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
2023-07-06 21:28:25 +00:00
CONSTRAINT ` scheduled_queries_pack_id ` FOREIGN KEY ( ` pack_id ` ) REFERENCES ` packs ` ( ` id ` ) ON DELETE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` scheduled_query_stats ` (
` host_id ` int ( 10 ) unsigned NOT NULL ,
` scheduled_query_id ` int ( 10 ) unsigned NOT NULL ,
2023-12-11 17:29:17 +00:00
` average_memory ` bigint ( 20 ) unsigned NOT NULL ,
2021-08-20 15:27:41 +00:00
` denylisted ` tinyint ( 1 ) DEFAULT NULL ,
2023-12-11 17:29:17 +00:00
` executions ` bigint ( 20 ) unsigned NOT NULL ,
2021-08-20 15:27:41 +00:00
` schedule_interval ` int ( 11 ) DEFAULT NULL ,
` last_executed ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2023-12-11 17:29:17 +00:00
` output_size ` bigint ( 20 ) unsigned NOT NULL ,
` system_time ` bigint ( 20 ) unsigned NOT NULL ,
` user_time ` bigint ( 20 ) unsigned NOT NULL ,
` wall_time ` bigint ( 20 ) unsigned NOT NULL ,
2023-12-13 20:46:59 +00:00
` query_type ` tinyint ( 4 ) NOT NULL DEFAULT ' 0 ' ,
PRIMARY KEY ( ` host_id ` , ` scheduled_query_id ` , ` query_type ` ) ,
2021-08-20 15:27:41 +00:00
KEY ` scheduled_query_id ` ( ` scheduled_query_id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-02-29 15:43:19 +00:00
CREATE TABLE ` script_contents ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` md5_checksum ` binary ( 16 ) NOT NULL ,
2024-03-04 16:00:08 +00:00
` contents ` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL ,
2024-02-29 15:43:19 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_script_contents_md5_checksum ` ( ` md5_checksum ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-09-11 15:54:34 +00:00
CREATE TABLE ` scripts ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` team_id ` int ( 10 ) unsigned DEFAULT NULL ,
` global_or_team_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2024-02-29 15:43:19 +00:00
` script_content_id ` int ( 10 ) unsigned DEFAULT NULL ,
2023-09-11 15:54:34 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_scripts_global_or_team_id_name ` ( ` global_or_team_id ` , ` name ` ) ,
2023-10-10 22:00:45 +00:00
UNIQUE KEY ` idx_scripts_team_name ` ( ` team_id ` , ` name ` ) ,
2024-02-29 15:43:19 +00:00
KEY ` script_content_id ` ( ` script_content_id ` ) ,
CONSTRAINT ` scripts_ibfk_1 ` FOREIGN KEY ( ` team_id ` ) REFERENCES ` teams ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` scripts_ibfk_2 ` FOREIGN KEY ( ` script_content_id ` ) REFERENCES ` script_contents ` ( ` id ` ) ON DELETE CASCADE
2023-09-11 15:54:34 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` sessions ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` accessed_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` user_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` key ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_session_unique_key ` ( ` key ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` software ` (
` id ` bigint ( 20 ) unsigned NOT NULL AUTO_INCREMENT ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` source ` varchar ( 64 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` bundle_identifier ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT ' ' ,
` release ` varchar ( 64 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` vendor_old ` varchar ( 32 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` arch ` varchar ( 16 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` vendor ` varchar ( 114 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-12-01 01:06:17 +00:00
` browser ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` extension_id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-12-01 14:33:07 +00:00
` title_id ` int ( 10 ) unsigned DEFAULT NULL ,
2023-12-12 22:51:58 +00:00
` checksum ` binary ( 16 ) NOT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
2023-12-12 22:51:58 +00:00
UNIQUE KEY ` idx_software_checksum ` ( ` checksum ` ) ,
2022-02-14 18:13:44 +00:00
KEY ` software_listing_idx ` ( ` name ` , ` id ` ) ,
2023-12-01 14:33:07 +00:00
KEY ` software_source_vendor_idx ` ( ` source ` , ` vendor_old ` ) ,
2023-12-07 23:43:37 +00:00
KEY ` title_id ` ( ` title_id ` ) ,
KEY ` idx_sw_name_source_browser ` ( ` name ` , ` source ` , ` browser ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` software_cpe ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` software_id ` bigint ( 20 ) unsigned DEFAULT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` cpe ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
2023-04-03 17:45:18 +00:00
UNIQUE KEY ` unq_software_id ` ( ` software_id ` ) ,
2022-02-02 21:34:37 +00:00
KEY ` software_cpe_cpe_idx ` ( ` cpe ` ) ,
2021-08-20 15:27:41 +00:00
CONSTRAINT ` software_cpe_ibfk_1 ` FOREIGN KEY ( ` software_id ` ) REFERENCES ` software ` ( ` id ` ) ON DELETE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` software_cve ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` cve ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2022-06-08 01:09:47 +00:00
` source ` int ( 11 ) DEFAULT ' 0 ' ,
2022-07-07 14:22:10 +00:00
` software_id ` bigint ( 20 ) unsigned DEFAULT NULL ,
2023-09-18 22:53:32 +00:00
` resolved_in_version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
2022-08-04 13:24:44 +00:00
UNIQUE KEY ` unq_software_id_cve ` ( ` software_id ` , ` cve ` ) ,
2022-08-24 17:10:58 +00:00
KEY ` software_cve_software_id ` ( ` software_id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-02-09 15:16:50 +00:00
CREATE TABLE ` software_host_counts ` (
` software_id ` bigint ( 20 ) unsigned NOT NULL ,
` hosts_count ` int ( 10 ) unsigned NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2022-02-28 18:55:14 +00:00
` team_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
PRIMARY KEY ( ` software_id ` , ` team_id ` ) ,
KEY ` idx_software_host_counts_updated_at_software_id ` ( ` updated_at ` , ` software_id ` ) ,
KEY ` idx_software_host_counts_team_id_hosts_count_software_id ` ( ` team_id ` , ` hosts_count ` , ` software_id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-02-09 15:16:50 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-04-25 11:48:44 +00:00
CREATE TABLE ` software_installers ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
2024-04-29 17:22:59 +00:00
` team_id ` int ( 10 ) unsigned DEFAULT NULL ,
` global_or_team_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` title_id ` int ( 10 ) unsigned DEFAULT NULL ,
` filename ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` version ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2024-05-16 22:09:41 +00:00
` platform ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2024-04-25 11:48:44 +00:00
` pre_install_query ` text COLLATE utf8mb4_unicode_ci ,
` install_script_content_id ` int ( 10 ) unsigned NOT NULL ,
` post_install_script_content_id ` int ( 10 ) unsigned DEFAULT NULL ,
2024-05-07 20:50:44 +00:00
` storage_id ` varchar ( 64 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2024-04-29 17:22:59 +00:00
` uploaded_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
2024-05-21 14:13:12 +00:00
` self_service ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
2024-04-25 11:48:44 +00:00
PRIMARY KEY ( ` id ` ) ,
2024-04-29 17:22:59 +00:00
UNIQUE KEY ` idx_software_installers_team_id_title_id ` ( ` global_or_team_id ` , ` title_id ` ) ,
KEY ` fk_software_installers_title ` ( ` title_id ` ) ,
2024-04-25 11:48:44 +00:00
KEY ` fk_software_installers_install_script_content_id ` ( ` install_script_content_id ` ) ,
KEY ` fk_software_installers_post_install_script_content_id ` ( ` post_install_script_content_id ` ) ,
2024-04-29 17:22:59 +00:00
KEY ` fk_software_installers_team_id ` ( ` team_id ` ) ,
2024-05-16 22:09:41 +00:00
KEY ` idx_software_installers_platform_title_id ` ( ` platform ` , ` title_id ` ) ,
2024-04-25 11:48:44 +00:00
CONSTRAINT ` fk_software_installers_install_script_content_id ` FOREIGN KEY ( ` install_script_content_id ` ) REFERENCES ` script_contents ` ( ` id ` ) ON UPDATE CASCADE ,
CONSTRAINT ` fk_software_installers_post_install_script_content_id ` FOREIGN KEY ( ` post_install_script_content_id ` ) REFERENCES ` script_contents ` ( ` id ` ) ON UPDATE CASCADE ,
2024-04-29 17:22:59 +00:00
CONSTRAINT ` fk_software_installers_team_id ` FOREIGN KEY ( ` team_id ` ) REFERENCES ` teams ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` fk_software_installers_title ` FOREIGN KEY ( ` title_id ` ) REFERENCES ` software_titles ` ( ` id ` ) ON DELETE SET NULL ON UPDATE CASCADE
2024-04-25 11:48:44 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-12-01 14:33:07 +00:00
CREATE TABLE ` software_titles ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` source ` varchar ( 64 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2023-12-07 23:43:37 +00:00
` browser ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2023-12-01 14:33:07 +00:00
PRIMARY KEY ( ` id ` ) ,
2023-12-07 23:43:37 +00:00
UNIQUE KEY ` idx_sw_titles ` ( ` name ` , ` source ` , ` browser ` )
2023-12-01 14:33:07 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-12-13 15:48:57 +00:00
CREATE TABLE ` software_titles_host_counts ` (
` software_title_id ` int ( 10 ) unsigned NOT NULL ,
` hosts_count ` int ( 10 ) unsigned NOT NULL ,
` team_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` software_title_id ` , ` team_id ` ) ,
KEY ` idx_software_titles_host_counts_team_counts_title ` ( ` team_id ` , ` hosts_count ` , ` software_title_id ` ) ,
KEY ` idx_software_titles_host_counts_updated_at_software_title_id ` ( ` updated_at ` , ` software_title_id ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2021-08-20 15:27:41 +00:00
CREATE TABLE ` statistics ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` anonymous_identifier ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` teams ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` description ` varchar ( 1023 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2022-03-21 19:16:47 +00:00
` config ` json DEFAULT NULL ,
2024-02-27 18:55:05 +00:00
` name_bin ` varchar ( 255 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin GENERATED ALWAYS AS ( ` name ` ) VIRTUAL ,
2024-06-27 21:10:49 +00:00
` filename ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` id ` ) ,
2024-06-27 21:10:49 +00:00
UNIQUE KEY ` idx_teams_filename ` ( ` filename ` ) ,
2024-02-27 18:55:05 +00:00
UNIQUE KEY ` idx_name_bin ` ( ` name_bin ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` user_teams ` (
` user_id ` int ( 10 ) unsigned NOT NULL ,
` team_id ` int ( 10 ) unsigned NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` role ` varchar ( 64 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
PRIMARY KEY ( ` user_id ` , ` team_id ` ) ,
KEY ` fk_user_teams_team_id ` ( ` team_id ` ) ,
CONSTRAINT ` user_teams_ibfk_1 ` FOREIGN KEY ( ` user_id ` ) REFERENCES ` users ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` user_teams_ibfk_2 ` FOREIGN KEY ( ` team_id ` ) REFERENCES ` teams ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` users ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
` password ` varbinary ( 255 ) NOT NULL ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` salt ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` name ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` email ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2021-08-20 15:27:41 +00:00
` admin_forced_password_reset ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` gravatar_url ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
` position ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ' ' ,
2021-08-20 15:27:41 +00:00
` sso_enabled ` tinyint ( 4 ) NOT NULL DEFAULT ' 0 ' ,
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
` global_role ` varchar ( 64 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL ,
2021-08-20 15:27:41 +00:00
` api_only ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_user_unique_email ` ( ` email ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2021-08-20 15:27:41 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
2022-08-26 18:55:03 +00:00
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2024-02-08 20:52:17 +00:00
CREATE TABLE ` vulnerability_host_counts ` (
` cve ` varchar ( 20 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` team_id ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` host_count ` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
UNIQUE KEY ` cve_team_id ` ( ` cve ` , ` team_id ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2023-11-01 14:13:12 +00:00
CREATE TABLE ` windows_mdm_command_queue ` (
` enrollment_id ` int ( 10 ) unsigned NOT NULL ,
` command_uuid ` varchar ( 127 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` enrollment_id ` , ` command_uuid ` ) ,
KEY ` command_uuid ` ( ` command_uuid ` ) ,
CONSTRAINT ` windows_mdm_command_queue_ibfk_1 ` FOREIGN KEY ( ` enrollment_id ` ) REFERENCES ` mdm_windows_enrollments ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` windows_mdm_command_queue_ibfk_2 ` FOREIGN KEY ( ` command_uuid ` ) REFERENCES ` windows_mdm_commands ` ( ` command_uuid ` ) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` windows_mdm_command_results ` (
` enrollment_id ` int ( 10 ) unsigned NOT NULL ,
` command_uuid ` varchar ( 127 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` raw_result ` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL ,
` response_id ` int ( 10 ) unsigned NOT NULL ,
` status_code ` varchar ( 31 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` enrollment_id ` , ` command_uuid ` ) ,
KEY ` command_uuid ` ( ` command_uuid ` ) ,
KEY ` response_id ` ( ` response_id ` ) ,
CONSTRAINT ` windows_mdm_command_results_ibfk_1 ` FOREIGN KEY ( ` enrollment_id ` ) REFERENCES ` mdm_windows_enrollments ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` windows_mdm_command_results_ibfk_2 ` FOREIGN KEY ( ` command_uuid ` ) REFERENCES ` windows_mdm_commands ` ( ` command_uuid ` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT ` windows_mdm_command_results_ibfk_3 ` FOREIGN KEY ( ` response_id ` ) REFERENCES ` windows_mdm_responses ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` windows_mdm_commands ` (
` command_uuid ` varchar ( 127 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` raw_command ` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL ,
` target_loc_uri ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` command_uuid ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` windows_mdm_responses ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` enrollment_id ` int ( 10 ) unsigned NOT NULL ,
` raw_response ` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` ) ,
KEY ` enrollment_id ` ( ` enrollment_id ` ) ,
CONSTRAINT ` windows_mdm_responses_ibfk_1 ` FOREIGN KEY ( ` enrollment_id ` ) REFERENCES ` mdm_windows_enrollments ` ( ` id ` ) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
2022-08-26 18:55:03 +00:00
CREATE TABLE ` windows_updates ` (
` id ` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
` host_id ` int ( 10 ) unsigned NOT NULL ,
` date_epoch ` int ( 10 ) unsigned NOT NULL ,
` kb_id ` int ( 10 ) unsigned NOT NULL ,
PRIMARY KEY ( ` id ` ) ,
UNIQUE KEY ` idx_unique_windows_updates ` ( ` host_id ` , ` kb_id ` ) ,
KEY ` idx_update_date ` ( ` host_id ` , ` date_epoch ` )
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
2022-08-26 18:55:03 +00:00
/* !40101 SET character_set_client = @saved_cs_client */ ;
2023-06-29 22:31:53 +00:00
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` wstep_cert_auth_associations ` (
` id ` varchar ( 255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` sha256 ` char ( 64 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` id ` , ` sha256 ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` wstep_certificates ` (
` serial ` bigint ( 20 ) unsigned NOT NULL ,
` name ` varchar ( 1024 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
` not_valid_before ` datetime NOT NULL ,
` not_valid_after ` datetime NOT NULL ,
` certificate_pem ` text COLLATE utf8mb4_unicode_ci NOT NULL ,
` revoked ` tinyint ( 1 ) NOT NULL DEFAULT ' 0 ' ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
` updated_at ` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` serial ` ) ,
CONSTRAINT ` wstep_certificates_ibfk_1 ` FOREIGN KEY ( ` serial ` ) REFERENCES ` wstep_serials ` ( ` serial ` )
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
/* !40101 SET @saved_cs_client = @@character_set_client */ ;
/* !40101 SET character_set_client = utf8 */ ;
CREATE TABLE ` wstep_serials ` (
` serial ` bigint ( 20 ) unsigned NOT NULL AUTO_INCREMENT ,
` created_at ` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( ` serial ` )
) ENGINE = InnoDB AUTO_INCREMENT = 2 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci ;
/* !40101 SET character_set_client = @saved_cs_client */ ;
2022-10-05 22:53:54 +00:00
/* !50001 DROP VIEW IF EXISTS `nano_view_queue` */ ;
/* !50001 SET @saved_cs_client = @@character_set_client */ ;
/* !50001 SET @saved_cs_results = @@character_set_results */ ;
/* !50001 SET @saved_col_connection = @@collation_connection */ ;
/* !50001 SET character_set_client = utf8mb4 */ ;
/* !50001 SET character_set_results = utf8mb4 */ ;
enforce an uniform collation for all tables (#10515)
related to #10441, inspired by the prior work done in
https://github.com/kolide/fleet/pull/1360, this PR:
1. Adds a migration to use `utf8mb4_general_ci` as the default collation
for the database and all the tables. From [MySQL's documentation][1]:
> To change the table default character set and all character columns
> (CHAR, VARCHAR, TEXT) to a new character set, use a statement like
> this:
>
> ```
> ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
> ```
> The statement also changes the collation of all character columns. If
> you specify no COLLATE clause to indicate which collation to use, the
> statement uses default collation for the character set.
2. Changes the connection settings to use `utf8mb4_general_ci` as the
default collation, from the [driver docs][2]:
> Sets the collation used for client-server interaction on
connection. In contrast to charset, collation does not issue additional
queries. If the specified collation is unavailable on the target server,
the connection will fail.
[1]: https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
[2]: https://github.com/go-sql-driver/mysql
**TODO:** discuss how we can enforce this, is setting the database
default collation enough? should we add some kind of custom lint rule to
all migrations?
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 18:49:24 +00:00
/* !50001 SET collation_connection = utf8mb4_unicode_ci */ ;
2022-10-05 22:53:54 +00:00
/* !50001 CREATE ALGORITHM=UNDEFINED */
/* !50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/* !50001 VIEW `nano_view_queue` AS select `q`.`id` AS `id`,`q`.`created_at` AS `created_at`,`q`.`active` AS `active`,`q`.`priority` AS `priority`,`c`.`command_uuid` AS `command_uuid`,`c`.`request_type` AS `request_type`,`c`.`command` AS `command`,`r`.`updated_at` AS `result_updated_at`,`r`.`status` AS `status`,`r`.`result` AS `result` from ((`nano_enrollment_queue` `q` join `nano_commands` `c` on((`q`.`command_uuid` = `c`.`command_uuid`))) left join `nano_command_results` `r` on(((`r`.`command_uuid` = `q`.`command_uuid`) and (`r`.`id` = `q`.`id`)))) order by `q`.`priority` desc,`q`.`created_at` */ ;
/* !50001 SET character_set_client = @saved_cs_client */ ;
/* !50001 SET character_set_results = @saved_cs_results */ ;
/* !50001 SET collation_connection = @saved_col_connection */ ;