{"id":43810,"library":"sequelize-hq","title":"Sequelize","description":"Sequelize is a promise-based Node.js ORM supporting Postgres, MySQL, MariaDB, SQLite, and Microsoft SQL Server. It offers solid transaction support, relations, eager and lazy loading, read replication, and more. This package (sequelize-hq) is a fork at v5.8.11-0.0.13, adding a safety feature to prevent accidental column deletion on alter sync. It follows SEMVER, requires Node >=6, and ships TypeScript types. Key differentiators include full-featured ORM with multiple database support, active community, and extensive documentation.","status":"active","version":"5.8.11-0.0.13","language":"javascript","source_language":"en","source_url":"https://github.com/sequelize/sequelize","tags":["javascript","mysql","mariadb","sqlite","postgresql","postgres","mssql","orm","nodejs","typescript"],"install":[{"cmd":"npm install sequelize-hq","lang":"bash","label":"npm"},{"cmd":"yarn add sequelize-hq","lang":"bash","label":"yarn"},{"cmd":"pnpm add sequelize-hq","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM import is preferred. CommonJS require works but may lack TypeScript type inference.","wrong":"const Sequelize = require('sequelize-hq')","symbol":"Sequelize","correct":"import { Sequelize } from 'sequelize-hq'"},{"note":"DataTypes is a named export. Ensure destructuring from module directly, not from Sequelize instance.","wrong":"const { DataTypes } = require('sequelize-hq').DataTypes","symbol":"DataTypes","correct":"import { DataTypes } from 'sequelize-hq'"},{"note":"Model is a named export, not a property on the default export.","wrong":"import Sequelize, { Model } from 'sequelize-hq'","symbol":"Model","correct":"import { Model } from 'sequelize-hq'"},{"note":"Op is exported as a named symbol. For CommonJS, use destructuring: const { Op } = require('sequelize-hq').","wrong":"const Op = require('sequelize-hq').Op","symbol":"Op","correct":"import { Op } from 'sequelize-hq'"}],"quickstart":{"code":"import { Sequelize, DataTypes, Model } from 'sequelize-hq';\n\nconst sequelize = new Sequelize(process.env.DB_NAME ?? 'test', process.env.DB_USER ?? 'root', process.env.DB_PASS ?? '', {\n  host: process.env.DB_HOST ?? 'localhost',\n  dialect: 'mysql' // or 'postgres', 'sqlite', 'mariadb', 'mssql'\n});\n\nclass User extends Model {}\nUser.init({\n  username: DataTypes.STRING,\n  birthday: DataTypes.DATE\n}, { sequelize, modelName: 'user' });\n\n(async () => {\n  try {\n    await sequelize.authenticate();\n    console.log('Connection has been established successfully.');\n    // Sync all models\n    await sequelize.sync({ force: true });\n    console.log('All models synced.');\n  } catch (error) {\n    console.error('Unable to connect to the database:', error);\n  } finally {\n    await sequelize.close();\n  }\n})();","lang":"typescript","description":"Shows how to establish a Sequelize connection, define a model, sync, and authenticate with configurable environment variables."},"warnings":[{"fix":"Use Model.init() with sequelize instance in options.","message":"In v5, Model.init() replaces define() for model definition. define() still works but is deprecated.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Remove operator aliases and use symbol operators from Op: { [Op.gt]: 5 }.","message":"In v5, the 'operatorsAliases' option is disabled by default. Using operators like $gt will fail.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use async/await instead of .then() chains.","message":"Promise-based API is deprecated in favor of async/await in v6 (unreleased).","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Set alertAndRemoveChangeColumn: true in sync options to prevent accidental column deletion, or handle manually.","message":"Running sequelize.sync({ alter: true }) may delete columns if not using the fork's alertAndRemoveChangeColumn option.","severity":"gotcha","affected_versions":"<=5.8.11-0.0.13"},{"fix":"Use import statements as shown in the quickstart.","message":"When using ESM, require() may not be available. Use import syntax.","severity":"gotcha","affected_versions":">=5.0.0"}],"env_vars":null,"search_vec":"'6':60 'accident':49 'activ':76 'ad':43 'alter':53 'base':7 'column':50 'communiti':77 'databas':74 'delet':51 'differenti':66 'document':80 'eager':25 'extens':79 'featur':46,70 'follow':56 'fork':40 'full':69 'full-featur':68 'hq':37 'includ':67 'javascript':81 'key':65 'lazi':27 'load':28 'mariadb':13,83 'microsoft':16 'mssql':87 'multipl':73 'mysql':12,82 'node':59 'node.js':8 'nodej':89 'offer':20 'orm':9,71,88 'packag':34 'postgr':11,86 'postgresql':85 'prevent':48 'promis':6 'promise-bas':5 'read':29 'relat':24 'replic':30 'requir':58 'safeti':45 'semver':57 'sequel':1,2,36 'sequelize-hq':35 'server':18 'ship':62 'solid':21 'sql':17 'sqlite':14,84 'support':10,23,75 'sync':54 'transact':22 'type':64 'typescript':63,90 'v5.8.11-0.0.13':42","created_at":"2026-06-05T17:01:35.526811+00:00","updated_at":"2026-06-05T17:01:35.526811+00:00","problems":[{"fix":"Start your database service or check connection config: host, port, credentials.","cause":"Database server not running or wrong host/port.","error":"SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306"},{"fix":"Call await sequelize.sync() or manually create the table.","cause":"Model not synced to database.","error":"SequelizeDatabaseError: Table 'test.users' doesn't exist"},{"fix":"Add import { DataTypes } from 'sequelize-hq' at the top of the file.","cause":"Missing import of DataTypes.","error":"TypeError: Cannot read properties of undefined (reading 'STRING')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"http://docs.sequelizejs.com/","github":"https://github.com/sequelize/sequelize","docs":null,"changelog":null,"pypi":null,"npm":"sequelize-hq","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}