dbmate

Automate multi-module SQL database migrations and rollbacks with dbmate.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/linchuncheng/skill-hub --skill dbmate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dbmate
Source: https://github.com/linchuncheng/skill-hub/tree/main/dbmate
Command: npx skills add https://github.com/linchuncheng/skill-hub --skill dbmate

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires dbmate, brew, and includes scripts (resource) components.

What problem does it solve?

dbmate 提供对多模块项目的数据库变更管理能力,确保表结构变更可追踪、可回滚,简化环境切换与配置管理。

Core Features & Use Cases

  • 自动跨模块迁移:按模块目录 sql/<module>/ 执行版本化迁移,确保顺序与依赖关系。
  • 环境配置与切换:支持 local、test 和 .env 等配置环境,方便在不同环境进行迁移。
  • 安全回滚与状态查看:每次迁移都附带回滚脚本,支持查看迁移状态与回滚最近一次变更。

Quick Start

Execute the migrate.sh script to run migrations for all modules.

Frequently Asked Questions about dbmate

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

FAQPage Schema
How do I manage database migrations across multiple modules?

Multi-module database migrations are managed by executing versioned SQL scripts within module-specific sql/<module>/ directories, ensuring correct sequence and dependency handling across the project.

How do I rollback the latest SQL migration for a specific module?

SQL migration rollback is supported by executing the migrate.sh script with rollback parameters, reverting the most recent schema changes for a selected module using dbmate.

How do I configure database migration environments for local and test setups?

Database migration environments are configured using a DATABASE_URL variable alongside local, test, and .env configuration files to manage environment-specific schema changes.

What directory structure is required for multi-module database migrations?

Multi-module database migrations require a local sql/<module>/ directory structure containing versioned SQL migration scripts and corresponding rollback files to execute properly.

Can I select specific modules to run database migrations on instead of all modules?

Per-module selection is supported during database migration, allowing you to target specific modular SQL directories rather than executing migrations across all modules.

Does dbmate work with brew for managing database schema migrations?

dbmate works with brew as a dependency to perform database schema migrations, applying versioned SQL files and managing automated rollback scripts across configured environments.