Skip to content

Commit fd343dc

Browse files
mnageorgekarrv
authored andcommitted
Fix missing collation in database migration (#18146)
1 parent 8fc0765 commit fd343dc

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.github/pull_request_template.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ If some of the following don't apply, delete the relevant line.
99
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements)
1010
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for new osquery data ingestion features.
1111
- [ ] Added/updated tests
12-
- [ ] If database migrations are included, checked table schema to confirm autoupdate
12+
- [ ] If database migrations are included, checked table schema to confirm autoupdate
1313
- For database migrations:
1414
- [ ] Checked schema for all modified table for columns that will auto-update timestamps during migration.
1515
- [ ] Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects.
16+
- [ ] Ensured the correct collation is explicitly set for character columns (`COLLATE utf8mb4_unicode_ci`).
1617
- [ ] Manual QA for all new/changed functionality
1718
- For Orbit and Fleet Desktop changes:
1819
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows and Linux.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Fixed an issue with the `20240327115617_CreateTableNanoDDMRequests` database migration where it could fail if the database did not default to the `utf8mb4_unicode_ci` collation.

server/datastore/mysql/migrations/tables/20240327115617_CreateTableNanoDDMRequests.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ func Up_20240327115617(tx *sql.Tx) error {
1414
CREATE TABLE mdm_apple_declarative_requests (
1515
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
1616
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
17-
enrollment_id VARCHAR(255) NOT NULL,
17+
enrollment_id VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL,
1818
-- Should be one of "tokens", "declaration-items", "status", or "declaration/…/…" where the ellipses reference a declaration on the server
19-
message_type VARCHAR(255) NOT NULL,
19+
message_type VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL,
2020
-- json payload
2121
raw_json TEXT,
2222
PRIMARY KEY (id),

0 commit comments

Comments
 (0)