📄️ Defining a Model
In this tutorial you will learn what models are in Sequelize and how to use them.
📄️ Data Types
Sequelize provides a lot of built-in data types. To access a built-in data type, you must import DataTypes:
📄️ Table & Column Naming Strategies
We are working on a new Naming Strategy API and seeking feedback. Don't hesitate to take a look at issue #15312.
📄️ Auto-generated Timestamps
By default, Sequelize automatically adds the attributes createdAt and updatedAt to every model, using the data type DataTypes.DATE.
📄️ Getters, Setters & Virtuals
Sequelize allows you to define custom getters and setters for the attributes of your models.
📄️ Validations & Constraints
Validations are checks performed by Sequelize, in pure JavaScript.
📄️ Indexes & Uniques
Sequelize supports adding indexes to the model definition which will be created during model synchronization.
📄️ Inheritance
Model inheritance is a way to share common attributes and methods between models.
📄️ Typing your Model (TypeScript)
Automated Attribute Typing
📄️ Advanced model definitions
Prevent creating a default PK attribute
📄️ Optimistic Locking
Sequelize has built-in support for optimistic locking through a model instance version count.
📄️ Paranoid Models
Sequelize supports the concept of paranoid tables.
📄️ Synchronizing your Models (development)
When you define a model, you're telling Sequelize a few things about its table in the database. However, what if the table actually doesn't even exist in the database? What if it exists, but it has different columns, less columns, or any other difference?
📄️ Migrations
Once your database has production data that should not be lost,