db-generate

Generate database migration files for Medusa modules via the Medusa CLI.

2|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/NagyVikt/codex-plugins --skill db-generate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-generate
Source: https://github.com/NagyVikt/codex-plugins/tree/main/plugins/medusa/skills/db-generate
Command: npx skills add https://github.com/NagyVikt/codex-plugins --skill db-generate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill removes the manual effort and syntax errors associated with creating database migration files for Medusa modules.

Core Features & Use Cases

  • Automated Migration Generation: Executes the Medusa CLI to scaffold migration files based on module changes.
  • Standardized Workflow: Ensures migrations are generated consistently across different modules like product or custom business logic.
  • Use Case: When you add a new field to your custom Medusa module, use this skill to quickly generate the necessary migration file before applying it to your database.

Quick Start

Use the db-generate skill to create a new migration for the product module.

Frequently Asked Questions about db-generate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate database migrations for a Medusa module?

Generating Medusa database migrations automatically creates the necessary migration files by executing the npx medusa db:generate CLI command. This removes manual effort and syntax errors when scaffolding schema updates for backend modules.

When do I need to generate a migration file in Medusa?

You need to generate a migration file in Medusa when you add a new field or update the schema of your custom Medusa module. This creates the file required to apply those data modeling changes to your database.

Do I need the Medusa CLI installed to scaffold database migrations?

Yes, you need a configured Medusa project environment and the Medusa CLI tool installed. The migration generation process relies directly on the CLI to execute the necessary database scaffolding commands.

Can I standardize database migration workflows across different Medusa modules?

Yes, automating the migration file generation ensures migrations are created consistently across different modules, such as product or custom business logic modules, by standardizing the scaffolding workflow via the CLI.

Why does my Medusa db:generate command fail when creating migrations?

The Medusa db:generate command fails if your project lacks a properly configured Medusa environment or if the Medusa CLI tool is not set up correctly. Ensure your backend environment is fully initialized before generating migrations.