Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.


Add Validations to a Model


An ORM like Sequelize can automatically validate a model's, or a column's, value.

Currently, you can successfully create a record by passing the Movie model instance an empty string for 'title', a negative 'runtime' integer, or even a release date that dates back to the pre-cinema era. For example:

const movie = await Movie.create({
  title: '',