Skip to Content
Phoenix Web Development
book

Phoenix Web Development

by Brandon Richey
April 2018
Beginner to intermediate content levelBeginner to intermediate
406 pages
9h 33m
English
Packt Publishing
Content preview from Phoenix Web Development

Writing the migration file

If we look back to our planned design for the uploads table, we came up with the following criteria for what we figured we'd need: We'll need a table to store the URL or path, the poll ID, the user ID, the alt text, and a caption. Let's create our migration and do all of the work the hard way so that we can reinforce all of these concepts and continue to learn how to build an Elixir and Phoenix app at a deep level! We'll start by generating the migration and then editing that generated file:

$ mix ecto.gen.migration create_images_table* creating priv/repo/migrations* creating priv/repo/migrations/20171117232649_create_images_table.exs

Then, we open up the migration file:

defmodule Vocial.Repo.Migrations.CreateImagesTable ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Phoenix in Action

Phoenix in Action

Geoffrey Lessel
Real-Time Phoenix

Real-Time Phoenix

Stephen Bussey

Publisher Resources

ISBN: 9781787284197Supplemental Content