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 vote record migration

To do this, we'll need to add another table to our database. This new table will have the explicit purpose of recording votes for each poll, which right now can just be something as simple as a list of IP addresses that have voted on a particular poll. It's a pretty simple feature and design, so we'll keep the table structure equally simple. Let's first create the migration for our vote_records table, which will record the poll_id and the ip_address:

$ mix ecto.gen.migration add_vote_records_table* creating priv/repo/migrations* creating priv/repo/migrations/20171125044437_add_vote_records_table.exs

We'll give it a very simple migration since our table design is also very simple:

defmodule Vocial.Repo.Migrations.AddVoteRecordsTable ...
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