Skip to content

Reference ​

Find what you need by entity or by task. Items marked postgrelize extension are postgrelize extensions that Sequelize v6 does not have; the full list is on the extensions page.

By entity ​

EntityGuideOptionsAPI
Models and attributesModelsModel optionsModel
Data typesData typesModel optionsDataTypes
DecoratorsDecoratorsModel optionsAPI index
AssociationsAssociationsModel optionsAssociation
Finders, aggregatesQueryingQuery optionsModel.findAll
ScopesScopesQuery optionsModel.scope
WritesQuerying, Upserts, Bulk writesWrite optionsModel.create
Raw SQLRaw SQLConnection optionsSequelize.query
TransactionsTransactionsConnection optionsTransaction
HooksHooks and validationModel optionsHookRegistry
ValidationValidationModel optionsValidationError
ErrorsErrors-DatabaseError
Connection, poolConnectionConnection optionsSequelize
Replicas, retry, sessionsSessions and scalingConnection optionsReplicationOptions
Schema, sync, DDLSchema, Schema objects, Constraints and indexesSchema optionsQueryInterface

By task ​

I want to...UseWhere
Define a modelsequelize.define, class extends Model + init, or decoratorsModels, Decorators
Store JSON, arrays, ranges, UUIDs, geometryDataTypes.JSONB, ARRAY, RANGE, UUID, geometric typesModels: data types
Use an identity or generated columnidentity, generated attribute options postgrelize extensionIdentity and generated columns
Filter rows with operatorswhere with OpFiltering
Search text (full-text, trigram, SIMILAR TO)toTsQuery, tsRank, trigramSimilarity postgrelize extensionOperator and search helpers
Paginatelimit, offset; keyset with tuple postgrelize extensionPaginating, Keyset
Count and aggregatecount, sum, max, groupAggregates
Load related rowsincludeEager loading
Take the latest N rows per parentinclude with lateral postgrelize extensionLATERAL joins
Reuse a filterscopesScopes
Run raw SQL safelysequelize.query with replacements or bindRaw SQL
Lock rowslock, skipLocked, noWait postgrelize extensionLocking, Row locks
Insert or update in one statementupsert, onConflict postgrelize extensionUpserts
Read old values after an updatereturningOld postgrelize extension (PostgreSQL 18)RETURNING OLD
Insert many rows quicklybulkCreate with unnest postgrelize extension, copyFrom postgrelize extensionBulk writes
Update or delete using another tableupdateStatement, deleteStatement postgrelize extensionUPDATE ... FROM
Sync rows from a source tableModel.merge postgrelize extensionMERGE
Export a tablecopyTo postgrelize extensionExport with copyTo
Process a huge table in batchesfindEach postgrelize extensionfindEach
Write recursive or multi-step queriesCTEs: with, source postgrelize extensionCommon table expressions
Rank or number rowsover(...) window functions postgrelize extensionWindow functions
Run several statements atomicallysequelize.transactionTransactions
Pick an isolation level or read-only modeisolationLevel, readOnly, deferrable postgrelize extensionTransactions
Serialize work across processeswithAdvisoryLock postgrelize extensionAdvisory locks
Push events between processeslisten, notify postgrelize extensionLISTEN / NOTIFY
Send reads to replicasreplication postgrelize extensionRead replicas
Stop a slow querystatementTimeout postgrelize extensionStatement timeout
Retry transient failuresretryRetrying
Handle a unique or foreign key violationUniqueConstraintError, ForeignKeyConstraintErrorErrors
Validate inputvalidators, validationSchema postgrelize extension (zod, valibot)Hooks and validation
React to create / update / destroyhooksHooks
Create tables, indexes and constraintssync, QueryInterface.createTable, addIndexSchema, Constraints and indexes
Use views, sequences, triggers, partitions, RLSQueryInterface.createView, createPartition, createPolicy postgrelize extensionSchema objects, Partitioning
Tune pool size, logging, timezoneSequelize constructor optionsConnection
Move from Sequelize v6change the importMigrating

Released under the MIT License.