Search⌘ K
AI Features

What are Migrations?

Explore how Ecto migrations help manage database structure by creating and altering tables using Elixir code. Understand their role in syncing databases across development and production environments, and learn how to apply migrations consistently in your projects.

For this last chapter on Ecto, we are going back to the beginning. In previous chapters, we’ve queried, updated, deleted, and sometimes mangled the dataset that came with our MusicDB application. Now we’re going to learn how to create those tables. Ecto uses migrations to create and alter tables in our database. Migration is a set of commands created in Elixir that contains the instructions for the changes we want to make. Ecto provides mix tasks to help us create, run and even roll back our ...