/u3_lab_sequelize_associations_exercise

In this lab, we'll be practicing associating the provided models.

Primary LanguageJavaScript

Associations Exercise

Getting Started

  • Fork and Clone
  • npm install
  • npm run test (Ensure that everything was installed correctly)
  • npx sequelize-cli db:create
  • npx sequelize-cli db:migrate
  • npx sequelize-cli db:seed:all

Overview

We'll be practicing associating the provided models. Foreign Keys have already been set up for you in the migrations. To confirm this open psql and connect to associations_development. Verify the schema is setup and the tables were created successfully. You'll only be working in the User and Article models. Utilizing the Resources Provided, associate the provided models and eager load the associated data. You must have 3 passing tests for completion. Run npm run test to check your work. Write your queries in the provided query.js file.

The associations are as follows:

  • User has many Articles as creator
  • Article belongs to User as creator

BONUS

  • User belongs to many Articles as bookmarks through UserBookmark
  • Article belongs to many User as bookmarks through UserBookmark

Lab

You'll need to setup the associations in the respective model in order for the queries to complete correctly. Run npm run test to check your work. If everything was done correctly 2 tests should pass. (3rd test is a bonus.)

Resources