Registry / database / sequelize

sequelize

JSON →
library6.37.8jsnpmunverified

Sequelize is a robust, promise-based Node.js ORM (Object-Relational Mapper) for various SQL databases including Postgres, MySQL, MariaDB, SQLite, and Microsoft SQL Server. The current stable version is 6.37.8, with version 7 actively under development in alpha. It offers features like transaction support, relations, eager/lazy loading, and read replication. The project is actively seeking new maintainers to finalize the next major release.

npm install sequelize
INSTALL
IMPORT
SIG · SEQUELIZE
S
sequelize
databasejavascriptv6.37.8
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Sequelize
import { Sequelize } from 'sequelize';
const { Sequelize } = require('sequelize');
DataTypes
import { DataTypes } from 'sequelize';
const { DataTypes } = require('sequelize');
Model
import { Model } from 'sequelize';
const { Model } = require('sequelize');

This quickstart demonstrates how to connect to an SQLite database, define a User model, synchronize the schema, create a new user, and fetch all users. It uses `sequelize.sync({ force: true })` for simplicity, which will drop and re-create tables on each run.

import { Sequelize, DataTypes, Model } from 'sequelize'; const sequelize = new Sequelize({ dialect: 'sqlite', storage: 'database.sqlite', logging: false // Disable logging for cleaner output }); class User extends Model {} User.init({ id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true }, username: { type: DataTypes.STRING, allowNull: false, unique: true }, email: { type: DataTypes.STRING, allowNull: false, unique: true } }, { sequelize, modelName: 'User' }); async function run() { try { await sequelize.authenticate(); console.log('Connection has been established successfully.'); await sequelize.sync({ force: true }); // This will drop existing tables console.log('All models were synchronized successfully.'); const jane = await User.create({ username: 'JaneDoe', email: 'jane.doe@example.com' }); console.log(`Created user: ${jane.username}`); const users = await User.findAll(); console.log('All users:', users.map(u => u.toJSON())); } catch (error) { console.error('Unable to connect to the database:', error); } finally { await sequelize.close(); } } run();
sequelize --version
Debug
Known issues
breakingUpgrading from Sequelize v5 to v6 introduces several breaking changes that require code modifications.
fix
Refer to the official upgrade guide for detailed instructions: https://sequelize.org/docs/v6/other-topics/upgrade-to-v6
affects: v5.x to v6.x
breakingA security vulnerability (CVE-2026-30951) allowed validation bypass in JSON where clauses, potentially leading to SQL injection.
fix
Upgrade to Sequelize v6.37.8 or higher immediately to apply the security fix.
affects: >=6.0.0 <6.37.8
gotchaSequelize requires a separate database dialect driver package to be installed manually (e.g., 'pg' for PostgreSQL, 'mysql2' for MySQL, 'sqlite3' for SQLite).
fix
Install the appropriate driver for your database, e.g., `npm install pg` for PostgreSQL.
affects: All versions
gotchaThe Sequelize project is actively seeking new maintainers, which might impact the pace of feature development or critical bug fixes for future major versions if not enough contributors join.
fix
Consider engaging with the community or contributing if specific features or urgent fixes are critical for your project. Join their Slack at sequelize.org/slack.
affects: v6.37.6 onwards (as per README announcement)
Errors
Common errors & fixes
SequelizeConnectionError: connect ECONNREFUSED 127.0.0.1:5432
The database server is not running, is inaccessible, or connection details are incorrect.
fix
Ensure your database server is running and accessible. Verify host, port, username, and password in your Sequelize configuration. Check firewall rules if applicable.
Error: Please install 'pg' module manually
The database dialect driver required by Sequelize (e.g., 'pg', 'mysql2') has not been installed.
fix
Install the correct driver for your database: `npm install pg` (PostgreSQL), `npm install mysql2` (MySQL/MariaDB), `npm install sqlite3` (SQLite).
SequelizeUniqueConstraintError: Validation error
An attempt was made to insert or update a record with a value that violates a unique constraint on a database field.
fix
Implement checks (e.g., using `Model.findOrCreate`) before creating records, or catch the `SequelizeUniqueConstraintError` and handle the duplicate entry gracefully.
SequelizeDatabaseError: ER_BAD_FIELD_ERROR: Unknown column '...' in 'field list'
The database schema does not match the Sequelize model definition, often due to missing or outdated migrations.
fix
Run database migrations to ensure your schema is up-to-date with your Sequelize models. Double-check column names and aliases in your queries.
Upgrade
Version history
6.37.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
12
Meta
2
Resources
sequelize — npm install sequelize · libregistry