Attempting to update Fleet from 4.41.0 to 4.44.0.....
# fleet
s
Attempting to update Fleet from 4.41.0 to 4.44.0... when running
fleet prepare db
, I'm getting what appears to be a non-recoverable error
Copy code
################################################################################
# WARNING:
#   This will perform Fleet database migrations. Please back up your data before
#   continuing.
#
#   Missing migrations: tables=[20240129162819 20240130115133], data=[].
#
#   Press Enter to continue, or Control-c to exit.
################################################################################

2024/02/12 18:58:14 [2024-01-29] Add Prefix To Windows Updates Profiles
2024/02/12 18:58:14 FAIL 20240129162819_AddPrefixToWindowsUpdatesProfiles.go (add w prefix to windows updates profiles uuid: Error 1054 (42S22): Unknown column 'w%' in 'where clause'), quitting migration.
Appears this fix is breaking: https://github.com/fleetdm/fleet/pull/16437
I don't actually have any data in that table, I just need to indicate the migration is complete
Replacing the double
"
with single
'
causes the query to succeed
Manually added the
migration_status_tables
entry, that was hacky
k
Interesting. Sorry you ran in to that! What version of MySQL are you using?
s
8.0.30
k
Thanks @Shawn Maddock! @Grant Bilstad or I will get a bug ticket submitted for this.
b
@Shawn Maddock do you have an example of the single vs. double quotes you can share? Thanks.
k
At a guess, it was this:
Copy code
stmt = `
		UPDATE
			host_mdm_windows_profiles
		SET
			profile_uuid = CONCAT("w", profile_uuid)
		WHERE
			profile_uuid NOT LIKE "w%";
	`
To this:
Copy code
stmt = `
		UPDATE
			host_mdm_windows_profiles
		SET
			profile_uuid = CONCAT("w", profile_uuid)
		WHERE
			profile_uuid NOT LIKE 'w%'
	`
s
Yeah more than just the one where clause
I'm getting errors upgrading the DB again. This time:
Copy code
Using config file: /etc/fleet/server.yml
################################################################################
# WARNING:
#   This will perform Fleet database migrations. Please back up your data before
#   continuing.
#
#   Missing migrations: tables=[20240327115617], data=[].
#
#   Press Enter to continue, or Control-c to exit.
################################################################################

2024/04/04 16:28:20 [2024-03-27] Create Table Nano DDM Requests
2024/04/04 16:28:20 FAIL 20240327115617_CreateTableNanoDDMRequests.go (creating mdm_apple_declarative_requsts: Error 3780 (HY000): Referencing column 'enrollment_id' and referenced column 'id' in foreign key constraint 'mdm_apple_declarative_requests_enrollment_id' are incompatible.), quitting migration.
This time I had to add
CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
to the
enrollment_id
definition in https://github.com/fleetdm/fleet/blob/f476ddcfd69f7398e34d150ac8be738b6bc03d11/ser[…]/migrations/tables/20240327115617_CreateTableNanoDDMRequests.go
I feel like my MySQL DB is in ultra-strict mode or something 😞
@Jason Lewis is this not the bug y’all fixed yesterday?
j
Hey @Shawn Maddock! Yes, I believe this is the one. 😕. Sorry it took so long to get fixed. cc @Kathy Satterlee @Grant Bilstad.
s
We had some DB migration issues a while back and @zwass chimed in letting us know MariaDB was not supported, only MySQL official. Now we've had two more in the last couple months, I assumed we were just doing something wrong again and not lining up with whatever environments your releases get tested with, but I couldn't figure out what.