In this episode, we're getting our database ready to store users who sign up or log in through social providers like Twitter. We start by looking at the default Laravel users table and realize there's a little problem: the password field isn't nullable, but social users (like those from Twitter) won't have a password to set. So, we need to tweak that!
First, we cover how to add a new column for storing the user's social provider ID—in this case, their Twitter (or "x") ID. We create a migration to add this as a nullable string column since not every user will have one (for example, someone who signs up with GitHub won't have a Twitter ID).
Next, we make the password field nullable as well. We walk through creating a new migration to update the existing table, since it's not a fresh install. There's a bit of an extra gotcha here: if you get a migration error, you might need to install the doctrine/dbal
package to allow changing existing columns. Once that's done, we check that everything's good in the database.
To wrap up, we mention updating the User model so you can mass-assign these new fields, and now we've got everything set so we can actually store social users when they come back to our app. All set—next up, creating those user records!