π§ Minimal Downtime Postgres Migration Using Logical Replication (with Scripts)
If you have a large Postgres database and need to migrate it to a new host - whether that's Fly.io to AWS RDS, self-hosted to managed, or any provider-to-provider move - a simple dump-and-restore will take your app offline for hours. For PagerTree, that amount of downtime was not acceptable. Instead, I used Postgres's built-in logical replication to stream data continuously from the old database to the new one while the app stayed live. This approach allowed me to keep downtime to about 10 minutes - just long enough to stop the app, verify replication is caught up, reset sequences, and point the app at the new database.
-85e45a5f66b1eef22b39d10d1548328c.png)


