3

Validating Models

It is important to maintain consistency and integrity within databases. Databases often use some form of constraint stipulation to ensure consistency. Typically, these constraints consist of checking for a range of values, such as minimum string length, uniqueness, or existence. Integrity for databases involves managing the associations and relations between symbiotic records. This involves cascading updates and deletions of referenced records (for example, setting the associated identity columns to NULL when the referenced record has been deleted). Consistency and integrity are not mutually exclusive to one another, but the two patterns help to ensure organization.

Note

The term consistency refers to ensuring that only ...

Get Supercharging Node.js Applications with Sequelize now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.