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 ...

Get Phoenix Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.