Migration Generator for Openclaw

An automated utility for generating timestamped SQL migration files directly from ORM schemas like Prisma and Drizzle.

lxgicstudios
v1.0.1
Jan 29, 2026
0
0
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install migration-gen

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install migration-gen using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Migration Generator?

Migration Generator is a specialized tool designed to bridge the gap between modern ORM schemas and raw database state management. By analyzing your existing schema definitions, it automatically produces robust SQL migration files that include both UP and DOWN operations, ensuring your database lifecycle remains predictable and manageable. As a key component within the Openclaw Skills ecosystem, this tool eliminates the manual overhead of writing complex SQL for schema changes while maintaining high standards for database versioning.

Built for speed and reliability, this skill supports widely used ORMs such as Prisma, Drizzle, TypeORM, and Sequelize. Openclaw Skills users can integrate this tool into their development environment with zero configuration, allowing for rapid schema iterations without compromising on the structural integrity of the production database.

Migration Generator Use Cases

  • Creating precise SQL migration files whenever application schema changes occur.
  • Converting high-level ORM definitions into raw SQL scripts for safer production deployments.
  • Standardizing migration folder structures across multi-developer teams.
  • Learning proper migration syntax and the implementation of SQL guard clauses.

How Migration Generator Works

  1. The tool identifies your project's ORM schema files by scanning the local directory.
  2. It parses the model definitions and relationships to detect required database structural changes.
  3. The system generates idempotent SQL statements for both applying (UP) and reverting (DOWN) the changes.
  4. It creates a timestamped folder containing up.sql and down.sql files, ensuring a chronological record of database evolutions.

Migration Generator Setup

To use this tool within the Openclaw Skills framework, ensure you have Node.js 18+ and an active environment variable for your AI provider.

# Set your API key
export OPENAI_API_KEY='your_api_key_here'

# Run the generator via npx
npx ai-migrate --orm prisma --name create_profile_table

Migration Generator Data Schema & Taxonomy

The skill organizes generated migrations into a strict filesystem hierarchy designed for version control systems.

Component Format Description
Directory Name YYYYMMDDHHMMSS_name/ Chronological folder for organizing SQL files.
up.sql SQL Script The migration logic required to apply changes to the database.
down.sql SQL Script The rollback logic required to revert the specific migration.
SQL Guards IF NOT EXISTS Automatic inclusion of safety guards to prevent execution errors.

Migration Generator Advanced Features

  • Cross-ORM Compatibility: Native support for Prisma, Drizzle, TypeORM, and Sequelize.
  • Custom Output Directory: Specify exactly where your migrations are stored using the --output flag.
  • Idempotent Script Generation: Automatically includes safety checks to ensure scripts can be run multiple times without failure.
  • Seamless Workflow Integration: Designed to work as a standalone CLI or as part of a larger Openclaw Skills automation pipeline.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*