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

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.