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

Modifying the users schema

We'll start off by generating the migration that we'll need to use to add more data to our user accounts. Specifically, we'll need to keep track of which user account is using which OAuth provider and what the external OAuth user ID is. Let's start by generating our OAuth schema migration:

$ mix ecto.gen.migration add_oauth_data_to_users* creating priv/repo/migrations* creating priv/repo/migrations/20180114145743_add_oauth_data_to_users.exs

Then, we need to actually pull up and modify that migration file. We can't be 100 percent sure what the format of the returning OAuth user ID may be, so we'll use a string to keep it simple and easy. The OAuth provider will also be a string:

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