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

Creating the Polls table migration

Based on that, let's create our new migration, add_polls_table:

$ mix ecto.gen.migration add_polls_table* creating priv/repo/migrations* creating priv/repo/migrations/20171005161434_add_polls_table.exs

By default, that will give us a mostly blank file consisting of:

defmodule Vocial.Repo.Migrations.AddPollsTable do use Ecto.Migration def change do endend

This allows us to start putting together the definitions for our table! Let's take a look at what this file does:

First, we define a new module under Vocial.Repo.Migrations called AddPollsTable (remember that the gen.migration command we had used previously took add_polls_table as the only argument).

Next, we tell Ecto that this module should be using the ...

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