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

Instruction

Add Validations to a Model

Overview

An ORM like Sequelize can automatically validate models, 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: '',
  runtime: -...