sequelize-cli
command.
config/config.json
file to match your database settings to
complete the initialization
process.
student.js
scholarship.js
student.js
class.js
student.js
lesson.js
include
model
and include
. This is in case you have nested
associations. In this case Owner
doesn't have an association with
PetType, but Pet does, so we want to
include PetType onto the Pet
Model.
findByPk
, findOne
, and findAll
methods. First, make sure you import the
models in your JavaScript file. In this
case, we are assuming your JavaScript
file is in the root of your project and
so is the models folder.
include
option.
findAll
method. You need to await this, so make
sure your function is async.
include
. This is possible because of the
association you have defined in your
Recipe and Ingredient models.
findOne
and findByPk
.
.build
the row and then .save
it, or you can .create
it. Either way it does the same thing.
Here are some examples:
update
. Let's say we want to change the
chicken noodle soup to chicken noodle
soup with extra veggies, first we need
to get the recipe, then we can update
it.
destroy
it, like this:
.then
and .catch
to do more with the items you are
accessing and modifying.