Registry / database / strapi-plugin-database-migration

strapi-plugin-database-migration

JSON →
library0.0.4jsnpmunverified

A Strapi plugin for executing database migrations using node-migrate. Version 0.0.4 is the latest stable release. It wraps node-migrate commands (strapi-migrate-up, strapi-migrate-down, strapi-migrate-list) and optionally stores migration state in the database via a built-in store. Differentiates from raw node-migrate by integrating with Strapi's lifecycle. The plugin has not been updated since 2020 and has limited adoption.

npm install strapi-plugin-database-migration
INSTALL
IMPORT
SIG · STRAPI-PLUGIN-DATA
S
strapi-plugin-database-migration
databasejavascriptv0.0.4
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-migrate-up
npx strapi-migrate-up
npm run strapi-migrate-up
Used as a CLI command via package.json scripts, not imported directly.
strapi-database-store
require('strapi-plugin-database-migration/lib/strapi-database-store')
import { strapiDatabaseStore } from 'strapi-plugin-database-migration'
The store is a CommonJS module; ESM import fails.

Shows how to set up scripts in package.json and create a sample migration file using the plugin.

// Add to package.json scripts: "strapi-migrate-up": "strapi-migrate-up --store strapi-plugin-database-migration/lib/strapi-database-store", "strapi-migrate-down": "strapi-migrate-down --store strapi-plugin-database-migration/lib/strapi-database-store", "strapi-migrate-list": "strapi-migrate-list --store strapi-plugin-database-migration/lib/strapi-database-store" // Create a migration file: migrations/001-create-users.js module.exports = { up: async (db) => { await db.createCollection('users'); }, down: async (db) => { await db.dropCollection('users'); } }; // Run migration: npm run strapi-migrate-up
Debug
Known issues
breakingNode.js version constraint <=14.x.x; fails on Node 16+.
fix
Use Node 14 or consider an alternative like node-migrate directly.
affects: >=0.0.0
gotchaThe 'strapi-migrate-up' command is a global binary; ensure it's installed or use npx.
fix
Run via npx: npx strapi-migrate-up --store ...
affects: >=0.0.0
gotchaNo TypeScript definitions; plugin uses require() style.
fix
Use CommonJS require; avoid ESM import.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'strapi-migrate-up'
Global binary not installed or not in PATH.
fix
Add the script to package.json scripts as shown in quickstart and run via npm run.
Error: The Node.js version (16.x.x) is not supported. Please use Node 10, 12, or 14.
Plugin explicitly restricts Node version in engines field.
fix
Use Node 14 or lower. If using Node 16+, migrate to a different solution.
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies
node-migraterequiredCore migration engine used under the hood
strapirequiredPlugin runs within Strapi ecosystem; requires Strapi to be installed
Agent activity
21 hits · last 30 days
node
16
Meta
2
OpenAI (training)
1
Resources
strapi-plugin-database-migration — npm install strapi-plugin-database-migration · libregistry