Registry / database / sequelize-typescript-migration-lts2

sequelize-typescript-migration-lts2

JSON →
library3.2.9jsnpmunverified

A migration tool for Sequelize with TypeScript models using decorators. Version 3.2.9 is the latest stable release, compatible with sequelize ~6. It automatically detects changes between model definitions and the current database schema, generating migration files (like Django's makemigrations). Only supports models defined with sequelize-typescript decorators, not raw Sequelize models. This LTS fork merges fixes from multiple forks of the original project. Release cadence is irregular. Key differentiator: eliminates manual up/down function writing for TypeScript projects.

npm install sequelize-typescript-migration-lts2
INSTALL
IMPORT
SIG · SEQUELIZE-TYPESCRI
S
sequelize-typescript-migration-lts2
databasejavascriptv3.2.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

SequelizeTypescriptMigration
import { SequelizeTypescriptMigration } from 'sequelize-typescript-migration-lts2'
const SequelizeTypescriptMigration = require('sequelize-typescript-migration-lts2')
Named export, not default. ESM import recommended.
MigrationOptions
import { MigrationOptions } from 'sequelize-typescript-migration-lts2'
import SequelizeTypescriptMigration from 'sequelize-typescript-migration-lts2'
Type import for config object; available as exported type.
makeMigration
import { SequelizeTypescriptMigration } from 'sequelize-typescript-migration-lts2'; const migration = new SequelizeTypescriptMigration(); await migration.makeMigration(sequelize, options);
import { makeMigration } from 'sequelize-typescript-migration-lts2'
makeMigration is a method on the class, not a standalone function.

Generates a migration file by comparing Sequelize models with the database, using in-memory SQLite.

import { join } from 'path'; import { Sequelize } from 'sequelize-typescript'; import { SequelizeTypescriptMigration } from 'sequelize-typescript-migration-lts2'; const sequelize = new Sequelize({ database: 'test', dialect: 'sqlite', storage: ':memory:', models: [__dirname + '/models'], }); const migration = new SequelizeTypescriptMigration(); async function run() { await migration.makeMigration(sequelize, { outDir: join(__dirname, './migrations'), migrationName: 'initial', preview: false, }); console.log('Migration generated'); } run().catch(console.error);
Debug
Known issues
gotchaOnly supports models defined with sequelize-typescript decorators; raw Sequelize models are not scanned for changes.
fix
Ensure all models use @Table, @Column, etc. from 'sequelize-typescript'.
affects: >=1.0.0
gotchaDown (undo) migrations may not work correctly due to ordering of foreign key dependencies; manual editing may be required.
fix
Review generated down commands for correct order; reorder manually if needed.
affects: >=1.0.0
deprecatedVersion 1.x is deprecated; use version ~2.x for sequelize ~6.
fix
Upgrade to sequelize@6 and sequelize-typescript-migration-lts2@~2.0.0 or later.
affects: ~1.0.0
gotchaThe package does not support TypeScript model files directly; it generates JavaScript migration files.
fix
Migration output is .js; write custom scripts if TypeScript output needed.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: SequelizeTypescriptMigration is not a constructor
Using default import instead of named import.
fix
Use `import { SequelizeTypescriptMigration } from 'sequelize-typescript-migration-lts2'`
Cannot find module 'sequelize-typescript-migration-lts2'
Package not installed or wrong import path.
fix
Run `npm install sequelize-typescript-migration-lts2` and verify import path.
Error: No models found. Ensure you are using sequelize-typescript decorators.
Models not loaded into Sequelize instance before calling makeMigration.
fix
Ensure Sequelize is initialized with model paths: `new Sequelize({ models: [__dirname + '/models'] })`
Upgrade
Version history
3.2.9latest on npm
Audit
Dependencies
sequelizerequiredPeer dependency required for migration generation
sequelize-typescriptrequiredRequired for decorator-based model scanning
Agent activity
13 hits · last 30 days
node
10
Meta
1
Resources
sequelize-typescript-migration-lts2 — npm install sequelize-typescript-migration-lts2 · libregistry