Registry / database / strapi-generate-migrations

strapi-generate-migrations

JSON →
library2.0.0jsnpmunverified

A Strapi generator that creates and runs Knex-based migration files for Strapi applications. Current stable version is 2.0.0. It provides CLI commands to scaffold new migrations and execute them against a Strapi database connection. Different from direct Knex usage, it integrates with Strapi's lifecycle and configuration, making it easier to manage database schema changes within Strapi projects. Release cadence is irregular; last major update was in 2020. Key differentiator: seamless integration with Strapi's API and CLI, supporting multiple database connections.

npm install strapi-generate-migrations
INSTALL
IMPORT
SIG · STRAPI-GENERATE-MI
S
strapi-generate-migrations
databasejavascriptv2.0.0
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.

strapi-generate-migrations
✓ No direct import; CLI tool used via `strapi migrate:make`
✗ import migrate from 'strapi-generate-migrations'
This is a CLI generator, not a module. Use the `strapi` CLI commands.

Shows how to generate and run migration files using the strapi CLI.

# Generate a migration strapi migrate:make default create_users_table # Run pending migrations strapi migrate:run default
Debug
Known issues
breakingVersion 2.0.0 changed the migration file naming convention. Existing migrations may need renaming.
fix
Review migration file names; they now follow YYYYMMDDHHMMSS_<name>.js pattern.
affects: =2.0.0
deprecatedThe `strapi migrate` command is deprecated in favor of Strapi v4's built-in D&D migrations.
fix
Consider migrating to Strapi v4's native migration system.
affects: >=2.0.0
gotchaConnection name must match exactly with Strapi's `connections` configuration in `config/environments/*/database.json`.
fix
Verify connection name in Strapi config before running commands.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'strapi-generate-migrations'
Package is not installed globally or locally.
fix
npm install strapi-generate-migrations --save-dev
Error: No connection found with name 'default'
Connection name does not match Strapi database config.
fix
Check config/environments/*/database.json for valid connection names.
Error: Migration directory not found
Missing `migrations` folder in Strapi project root.
fix
Create a `migrations` folder or specify custom path in generator options.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
strapi-utilsoptionalCore utilities for Strapi generators
knexrequiredUnderlying SQL query builder and migration tool
Agent activity
24 hits · last 30 days
node
20
OpenAI (training)
1
Resources
strapi-generate-migrations — npm install strapi-generate-migrations · libregistry