Creating our user model
Since we are managing user sessions in our app, we will need to store information about our users in order to check their credentials, before we allow our to-do items to be created, deleted, and edited. We will store our user data in our PostgreSQL database. While this is not essential, we will also link users in the database to to-do items. This will give us an understanding of how to alter an existing table and create links between tables. In order to create our user model, we are going to have to do the following:
- Create a
user
data model. - Create a
NewUser
data model. - Alter the to-do item data model so that we can link it to a user model.
- Update the schema file with the new table and altered fields.
- Create and run migration scripts on the database.
In the following sections, we'll look at the preceding steps in detail.
Creating a user data model
Before we start, we will need to update the dependencies in the Cargo...