Sequelize: ORM For Node - Js
Sequelize: ORM For Node - Js
Cons-
• Overhead of learning
• Initial configuration takes time
• Developer wont be knowing what is happening under the hood
Why Sequelize ?
• Different ORMs available – TypeORM, Prisma, Sequelize, BookShelf
• Prisma –
• Auto-generated query builder ,
• Graphql support with all queries for CRUD operations
• Support less DBs compared to other ORMs.
• Not matured compared to other ORMs, some features are in experimental
• Some datatypes like json, array, timestampZ are not supported
• TypeORM –
• traditional ORM
• Good support for Typescript and latest JS features.
What Sequelize provide
• Promise based
• Support for multiple DBs
• DB sync
• DB migrations
• Model hooks
• Associations – belongsTo , hasMany, hasOne, belongsToMany
• Transaction support
• Raw queries
• Easy to test
• Rich Documentation
• Stable
How Sequelize works
• Install Sequelize
• Connect to DB
• Create Model for mapping
• Mapping Model to DB- sync (Model First Approach)
• CRUD operations.
More Details -
https://sequelize.org/v5/index.html
DEMO
Thanks