Safe Ecto Migrations

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:

  1. Understand Ecto migrations
  2. Migrate and rollback the database using Mix releases
  3. 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

Fly ❤️ Elixir

Fly is an awesome place to run your Elixir apps. It's really easy to get started. You can be running in minutes.

Deploy your Elixir app today!