Evil Martians helped Whop migrate their high-traffic Rails application from PostgreSQL to PlanetScale MySQL without downtime or pausing development. The migration used a dual-database strategy with an environment variable toggle, allowing developers to continue shipping features while addressing compatibility issues. Key challenges included handling decimal precision defaults, timestamp fractional seconds, JSON indexing limitations, array type conversions, partial index workarounds using NULL behavior, materialized view replacements, NULL sorting differences, and rewriting DISTINCT ON queries with window functions. The success came from embracing MySQL's design philosophy rather than trying to replicate PostgreSQL's features.

13m read timeFrom evilmartians.com
Post cover image
Table of contents
Whop makes the decision to migrateThe schema safari: where data types roam wildThe query chronicles: syntactic adventuresThe migration postmortemThe end…?

Sort: