Anyone ever migrated a Go backend from Postgres to MySQL (with GORM)?

Hey everyone! I’m currently working on a Go backend that utilizes GORM with Postgres, along with some direct SQL queries. I need to transition everything to MySQL for an upcoming project.

Has anyone in this community completed a similar migration? I’m looking for tips on what potential issues I should be cautious of, like UUIDs, jsonb, CTEs, or any changes necessary for raw queries.

I’d love to hear your experiences or any challenges you encountered during the process. Thank you! :pray:

Oh interesting! What made you switch from Postgres to MySQL? Company requirement or performance issues? Also, are you sticking with GORM or thinking about switching ORMs too? Might be worth exploring other options since you’re already making big changes :thinking:

Did this migration last year and hit a bunch of gotchas. UUIDs were the worst part - MySQL stores them as CHAR(36) instead of having a real UUID type, which killed performance until I switched to BINARY(16) with conversion functions. Had to completely rewrite anything using JSONB since MySQL’s JSON functions work totally differently. CTEs were a nightmare too - ended up ripping out all the recursive queries and replacing them with temp tables or subqueries. If you’re using GORM, definitely update your struct tags and test every single relationship. Foreign key constraints don’t work the same way between the two DBs.

totally feel ya! went through the same thing. had issues with the dates too, make sure to double-check those. MySQL can be tricky with timezone stuff. good luck with the migration! :sweat_smile: