Skip to content

Instantly share code, notes, and snippets.

@pushcx
Last active March 3, 2026 07:55
Show Gist options
  • Select an option

  • Save pushcx/eb7cdf2dc9707dc3ab9e7173d197ddfc to your computer and use it in GitHub Desktop.

Select an option

Save pushcx/eb7cdf2dc9707dc3ab9e7173d197ddfc to your computer and use it in GitHub Desktop.

sqlite migration checklist:

  • main:
  • set the site in read-only mode (config/application.rb on prod)
  • link to this gist from app/views/layouts/application.html.erb
  • lobsters-deploy
  • take mariadb backup to pushcx's desktop
  • scp lib/tasks/migrate.rake l:lobsters/current/lib/tasks
  • be rails dump_db
  • scp db to my local dev
  • disable screensharing a sec
  • edit prod config/database.yml: primary: # <<: *trilogy # database: lobsters <<: *sqlite3 database: db/primary.sqlite3
  • scp db/development/primary.sqlite3 l:lobsters/shared/storage/
  • be rails load_db
  • jj edit pmynxpks; jj bookmark set main; jj up
  • lobsters-deploy
  • if prod doesn't immediately melt down, rm read-only mode, notice, and trilogy gem
  • take a sqlite backup to local dev
  • run the backup script
  • confirm the backup worked
  • tomorrow 2026-02-22: confirm the automated backup script ran

revert checklist

  • revert the merge commit
  • stop puma
  • revert DATABASE_URL
  • revert prod config/database.yml
  • lobsters-deploy
  • restart puma
  • restart bg jobs
  • remove the layout note, read-only mode
  • lobsters-deploy
  • prod: mv storage/primary.sqlite3 ~

perf notes

Lobsters(prod)> ActiveRecord::Base.connection.execute("PRAGMA foreign_keys") => [{"foreign_keys" => 1}] Lobsters(prod)> ActiveRecord::Base.connection.execute("PRAGMA journal_mode") => [{"journal_mode" => "wal"}] Lobsters(prod)> ActiveRecord::Base.connection.execute("PRAGMA synchronous") => [{"synchronous" => 1}] Lobsters(prod)> ActiveRecord::Base.connection.execute("PRAGMA mmap_size") => [{"mmap_size" => 134217728}] Lobsters(prod)> ActiveRecord::Base.connection.execute("PRAGMA journal_size_limit") => [{"journal_size_limit" => 67108864}] Lobsters(prod)> ActiveRecord::Base.connection.execute("PRAGMA cache_size") => [{"cache_size" => 2000}]

DATABASE_URL sqlite3:///home/deploy/lobsters/current/storage/primary.sqlite3

@evrimoztamur
Copy link

History being re-written (to SQLite)

@regalialong
Copy link

regalialong commented Feb 21, 2026

MariaDB -> SQLite.... seems like a downgrade unless I'm missing something?

Edit: yep i was
image

further reading here seemingly

And from the resulting PR:

Thanks for all this work, what a big project!

Any readers: we're on a call and going to migrate prod now.

@dzwdz
Copy link

dzwdz commented Feb 21, 2026

๐Ÿฆ€๐Ÿฆ€๐Ÿฆ€ lobste.rs is gone ๐Ÿฆ€๐Ÿฆ€๐Ÿฆ€

@AngelOnFira
Copy link

image

wild to see in 2026, great stuff

@mtmn
Copy link

mtmn commented Feb 21, 2026

inspiring move, let's gooo <3

@vlofgren
Copy link

Godspeed!

@NinoSkopac
Copy link

is this just fanta sea?

@CounterPillow
Copy link

i am a heron. i haev a long neck and i pick fish out of the water w/ my beak. if you dont repost this comment on 10 other pages i will fly into your kitchen tonight and make a mess of your pots and pans

@AquariusDue
Copy link

I was here for the SQLite migration!

@NinoSkopac
Copy link

2/22 never forget

btw can someone hire me, im looking for some k8s work, that'd be great, ty ty

@shoenot
Copy link

shoenot commented Feb 21, 2026

to sqlite ๐Ÿ˜ฎ

@NinoSkopac
Copy link

๐Ÿ˜‚

@JaspritBola
Copy link

๐Ÿš€

@otonoton
Copy link

What was the rationale for migrating to SQLite in the first place?

@olivia-banks
Copy link

What was the rationale for migrating to SQLite in the first place?

lobsters/lobsters#1871

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment