Migrating GOTM from MySQL to Turso

📅 2025-03-30

⌛ 608 days ago

📖 3 min read



I maintain the PG GOTM site, a game of the month voting site for a Discord server.

I’m no stranger to accidentally rm -rf / on my VPS. And I thought, maybe I don’t want to be the only thing standing between our 6 years of votes on GOTM and total oblivion.

The Project

The MySQL GOTM database has a lot of history (goes as far back as September 2018!). It’s quite a well structured database with solid FK constraints.

I’m quite familiar and happy with MySQL, I use it in production all the time but generally that is in a managed environment. I’ve hosted my fair share of MySQL databases but I’d rather simpl(er) and easier backups in case I nuke the VPS again.

Now that PlanetScale doesn’t have a hobby plan anymore, I started looking at Turso, which I heard about from one of ThePrimeagen’s videos. It seemed super cool and they’ve recently announced a Rust re-write of SQLite. I just needed a side project to try it out on and this seemed as good an opportunity as any.

Why Turso?

I’ve never used Turso before but I’ve used SQLite a lot. Every single fun side project of mine begins with an SQLite database.

Turns out, Turso is literally just SQLite with a sync layer on top (okay technically it’s a fork called libSQL which extends SQLite to support replication, remote writes, and syncing).

That’s kind of cool honestly. I don’t enjoy managing volumes in k3s and my restic + Backblaze scripts still need a lot of work.

Migration Notes

Fortunately, a lot of the MySQL schema was easily translatable to SQLite. I only had to handle a few things:

  • No ENUM type in SQLite, I ended up using another table with a FK
  • Replace MySQL’s DATETIME with a basic INTEGER UNIX timestamp

And I think that’s about it. It was fairly painless. I wrote a simple script that moved the data of every table from the MySQL server to Turso.

How’s it going?

We’ve just completed our first month of voting with this new setup. I think it went quite well! (Except the part where I copied over the dev .env to prod).

And I really like that Turso gives you a web-based SQLite client:

Turso web client showing the GOTM database tables

I’m used to using DataGrip for everything and it sucks that it can’t read SQLite files over SSH. This is a huge plus. Here’s some stats after a full month of voting:

Turso usage stats after one month of GOTM voting

I’m quite happy with the performance and it also seems like I’ll remain well under the free tier.

I’m not going to miss worrying about backups.

What’s next?

I like Turso. I’ll probably move a couple more of my projects over to it HamVerBot has already been converted 🙃.