{"id":49449,"library":"strapi-generate-migrations","title":"Strapi Generate Migrations","description":"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.","status":"maintenance","version":"2.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/wistityhq/strapi","tags":["javascript","generate","generator","knex","migrations","sql","strapi","transactions"],"install":[{"cmd":"npm install strapi-generate-migrations","lang":"bash","label":"npm"},{"cmd":"yarn add strapi-generate-migrations","lang":"bash","label":"yarn"},{"cmd":"pnpm add strapi-generate-migrations","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core utilities for Strapi generators","package":"strapi-utils","optional":true},{"reason":"Underlying SQL query builder and migration tool","package":"knex","optional":false}],"imports":[{"note":"This is a CLI generator, not a module. Use the `strapi` CLI commands.","wrong":"import migrate from 'strapi-generate-migrations'","symbol":"strapi-generate-migrations","correct":"No direct import; CLI tool used via `strapi migrate:make`"}],"quickstart":{"code":"# Generate a migration\nstrapi migrate:make default create_users_table\n\n# Run pending migrations\nstrapi migrate:run default","lang":"bash","description":"Shows how to generate and run migration files using the strapi CLI."},"warnings":[{"fix":"Review migration file names; they now follow YYYYMMDDHHMMSS_<name>.js pattern.","message":"Version 2.0.0 changed the migration file naming convention. Existing migrations may need renaming.","severity":"breaking","affected_versions":"=2.0.0"},{"fix":"Consider migrating to Strapi v4's native migration system.","message":"The `strapi migrate` command is deprecated in favor of Strapi v4's built-in D&D migrations.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Verify connection name in Strapi config before running commands.","message":"Connection name must match exactly with Strapi's `connections` configuration in `config/environments/*/database.json`.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2.0.0':23 '2020':73 'api':81 'applic':18 'base':13 'cadenc':65 'chang':60 'cli':26,83 'command':27 'configur':52 'connect':39,87 'creat':8 'current':19 'databas':38,58,86 'differ':40 'differenti':75 'direct':42 'easier':55 'execut':33 'file':15 'generat':2,6,89,90 'integr':46,77 'irregular':67 'javascript':88 'key':74 'knex':12,43,91 'knex-bas':11 'last':68 'lifecycl':50 'major':69 'make':53 'manag':57 'migrat':3,14,31,92 'multipl':85 'new':30 'project':63 'provid':25 'releas':64 'run':10 'scaffold':29 'schema':59 'seamless':76 'sql':93 'stabl':20 'strapi':1,5,17,37,48,62,79,94 'support':84 'transact':95 'updat':70 'usag':44 'version':21 'within':61","created_at":"2026-06-07T17:01:50.452400+00:00","updated_at":"2026-06-07T17:01:50.452400+00:00","problems":[{"fix":"npm install strapi-generate-migrations --save-dev","cause":"Package is not installed globally or locally.","error":"Error: Cannot find module 'strapi-generate-migrations'"},{"fix":"Check config/environments/*/database.json for valid connection names.","cause":"Connection name does not match Strapi database config.","error":"Error: No connection found with name 'default'"},{"fix":"Create a `migrations` folder or specify custom path in generator options.","cause":"Missing `migrations` folder in Strapi project root.","error":"Error: Migration directory not found"}],"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://strapi.io","github":"git://github.com/wistityhq/strapi","docs":null,"changelog":null,"pypi":null,"npm":"strapi-generate-migrations","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}