Your First Migration
To get a feel for how to write migrations, we’re going to add a new table to our MusicDB project.
We’ve been using the tracks table to keep track of recordings of songs that have appeared on specific albums. But many artists record songs that they did not write themselves, and certain songs appear on more than one album. For example, in our current dataset, the song “Freddie Freeloader” appears on two different albums. We’ll create a compositions table to track the metadata of the songs that appear in our dataset, and later link them to specific tracks records.
The easiest way to create a new migration is to use the mix task that Ecto provides: mix ecto.gen.migration. This task has one required argument: the name of the ...