Self-service categories - migration (#46488)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #46390 Migration to add a non nullable team_id column. I chose this approach so that server code doesn't have to deal with a potentially null team id for categories. It first adds team_id=0 to all the existing categories, then duplicates that for every fleet so that default categories can be edited and deleted by admins. It also renames the default categories to include the emojis in their name, which required updating some test expectations, and also mapping default names to the new ones for Fleet maintained apps. If we don't do that, FMA's manifests would have to all be updated right after 4.87 releases and every user would have to migrate immediately. This would also break existing gitops files if the names aren't mapped. The alternative would be to keep the names unchanged, and add custom logic in various places to insert the emojis in the backend and frontend. # Checklist for submitter If some of the following don't apply, delete the relevant line. ## Testing - [x] Added/updated automated tests - [ ] Where appropriate, [automated tests simulate multiple hosts and test for host isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing) (updates to one hosts's records do not affect another) - [x] QA'd all new/changed functionality manually ## Database migrations - [x] Checked schema for all modified table for columns that will auto-update timestamps during migration. - [x] Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects. - [x] Ensured the correct collation is explicitly set for character columns (`COLLATE utf8mb4_unicode_ci`).
This commit is contained in:
@@ -150,6 +150,7 @@ func LoadSchema(t testing.TB, testName string, opts *DatastoreTestOptions, schem
|
||||
"docker", "compose", "exec", "-T", "mysql_test",
|
||||
// Command run inside container
|
||||
"mysql",
|
||||
"--default-character-set=utf8mb4",
|
||||
"-u"+TestUsername, "-p"+TestPassword,
|
||||
)
|
||||
cmd.Stdin = strings.NewReader(sqlCommands)
|
||||
@@ -171,6 +172,7 @@ func LoadSchema(t testing.TB, testName string, opts *DatastoreTestOptions, schem
|
||||
"docker", "compose", "exec", "-T", "mysql_replica_test",
|
||||
// Command run inside container
|
||||
"mysql",
|
||||
"--default-character-set=utf8mb4",
|
||||
"-u"+TestUsername, "-p"+TestPassword,
|
||||
)
|
||||
cmd.Stdin = strings.NewReader(sqlCommands)
|
||||
|
||||
Reference in New Issue
Block a user