Fly.io runs apps close to users, by transmuting Docker containers into micro-VMs that run on our own hardware around the world. This post launches off the Safe Ecto Migrations series guide. If you just want to ship your Phoenix app, the easiest way to learn more is to try it out; you can be up and running in just a couple minutes.
As an Elixir developer who cares about system up-time and avoiding “scheduled maintenance” windows, and more importantly avoiding “unscheduled maintenance” windows 😉, this guide dives deep into Ecto database migrations and how they can be used safely in production systems.
This is guide comes in a 4 part series of posts. The guide helps you:
- Understand Ecto migrations
- Migrate and rollback the database using Mix releases
- Avoid pitfalls during migrations
This guide includes a set of recipes for common migration scenarios. You can jump ahead to those, but it is helpful to understand what’s going on at a deeper level and to get your project setup ahead of time for running migrations in a production environment and
Note: This guide uses PostgreSQL and may differ if you’re using a different database. I’ll note where differences may be, but I do not go into depth on different database systems. This was also written using Ecto 3.6.x.
Guide Table of Contents
- Part 1: Anatomy of an Ecto migration
- Part 2: How to migrate Mix Release projects
- Part 3: Migration Recipes
- Part 4: Backfilling Data