Registry / database / gina-sequelize

gina-sequelize

JSON →
library0.0.16jsnpmunverified

Gina is a CLI tool that auto-generates and runs database migrations based on Sequelize ORM models. It compares your current Sequelize model definitions with the actual database schema and produces migration files to synchronize them. The current stable version is 0.0.16, released infrequently. Key differentiators: automatic migration generation from existing models, supports TypeScript, requires a custom `initializeModels` function. It is designed for projects already using Sequelize and needing an automated migration workflow.

npm install gina-sequelize
INSTALL
IMPORT
SIG · GINA-SEQUELIZE
G
gina-sequelize
databasejavascriptv0.0.16
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.

gina-cli
npx gina-cli <command>
gina <command>
The CLI command is 'gina-cli', not 'gina'. Use npx for one-time execution.
initializeModels
export async function initializeModels(): Promise<Sequelize> { ... }
module.exports = async function() {}
Must be a named export from 'initializeModels.ts', returning a Sequelize instance with models already loaded.
Migration
import { Migration } from 'gina-sequelize'
TypeScript type for migration objects; exported from the package.

Shows full setup: global install, init, editing initializeModels, generating and running a migration.

// Step 1: Install globally npm install -g gina-sequelize ts-node // Step 2: Initialize in your project cd your-project npx gina-cli init // Step 3: Edit gina/initializeModels.ts // Example: import { Sequelize } from 'sequelize'; import { User } from './models/User'; // your model export async function initializeModels(): Promise<Sequelize> { const sequelize = new Sequelize('database', 'username', 'password', { host: 'localhost', dialect: 'postgres' }); // Load models User.init(sequelize); // ... other models return sequelize; } // Step 4: Generate a migration npx gina-cli generate-migration "Add user table" // Step 5: Run the migration npx gina-cli upgrade
Debug
Known issues
gotchaGlobal install is required for CLI usage; using npx gina-sequelize will not work.
fix
Install globally: npm install -g gina-sequelize ts-node
affects: >=0.0.1
breakingIn version 0.0.16, the initializeModels file must export a named function called 'initializeModels', not a default export.
fix
Use 'export async function initializeModels()' instead of 'export default async function()'
affects: 0.0.16
gotchaThe CLI command is 'gina-cli', not 'gina'. Running 'gina' will fail.
fix
Use 'gina-cli' for all commands.
affects: >=0.0.1
deprecatedUsing require() to load initializeModels may not work; the package expects an ES module with named export.
fix
Use ES module syntax and named export.
affects: >=0.0.10
gotchats-node must be installed alongside gina-sequelize, otherwise migrate commands will fail.
fix
Install ts-node globally: npm install -g ts-node
affects: >=0.0.1
breakingThe generated migration files may not handle all Sequelize associations or indexes correctly; manual review advised.
fix
Manually verify and adjust generated migration files before running.
affects: 0.0.16
Errors
Common errors & fixes
gina: command not found
Using 'gina' instead of 'gina-cli'
fix
Use 'gina-cli' command
Cannot find module 'gina/initializeModels'
initializeModels.ts not in the correct location or not exported as named function
fix
Ensure file exists at gina/initializeModels.ts and exports a named function 'initializeModels'
ts-node is not recognized
ts-node not installed globally
fix
Run: npm install -g ts-node
TypeError: sequelize.define is not a function
initializeModels returns a Sequelize instance without loading models using Model.init()
fix
Use Model.init(sequelize) for each model, not sequelize.define
Upgrade
Version history
0.0.16latest on npm
Audit
Dependencies
ts-noderequiredRequired for running TypeScript migration files and the initializeModels function.
Agent activity
2 hits · last 30 days
node
2
Resources