Creates migration files for CatchAdmin. Standardizes field types and boilerplate for database schema changes.

Install

mkdir -p .claude/skills/migration && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6654" && unzip -o skill.zip -d .claude/skills/migration && rm skill.zip

Installs to .claude/skills/migration

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Generate database migration file for CatchAdmin module.
55 charsno explicit “when” trigger
Beginner

Key capabilities

  • Generates migration files with standard CatchAdmin boilerplate
  • Maps standard field types like string, text, and integer to migration code
  • Configures unsignedInteger for timestamps and deleted_at fields
  • Adds index() calls to foreign key definitions
  • Implements down() method for schema reversal

How it works

It populates a pre-defined PHP template using a mapping table to convert user-defined types into specific migration methods.

Inputs & outputs

You give it
Table name and field definitions
You get back
A PHP migration file in modules/{Module}/database/migrations/

When to use migration

  • Create new database migration for CatchAdmin module
  • Define table schema using standard field types
  • Add indexes to migration files

About this skill

Step 2: Generate Migration

创建数据库迁移文件。

File Location

modules/{Module}/database/migrations/{timestamp}_create_{table}_table.php

Template

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('{table}', function (Blueprint $table) {
            $table->id();
            
            // Business fields (generated from definition)
            
            // CatchAdmin standard fields
            $table->unsignedInteger('creator_id')->default(0);
            $table->unsignedInteger('created_at')->default(0);
            $table->unsignedInteger('updated_at')->default(0);
            $table->unsignedInteger('deleted_at')->default(0);
            
            // Indexes
            $table->index(['status', 'deleted_at']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('{table}');
    }
};

Field Type Mapping

TypeMigration Code
string(n)$table->string('name', n)
text$table->text('description')->nullable()
integer$table->unsignedInteger('count')->default(0)
decimal(m,n)$table->decimal('price', m, n)
tinyint$table->tinyInteger('status')->default(1)
foreign_key$table->unsignedBigInteger('category_id')->default(0)->index()
date$table->date('birth_date')->nullable()
datetime$table->dateTime('published_at')->nullable()
json$table->json('options')->nullable()

Important

  • CatchAdmin 使用 unsigned integer 作为时间戳,不使用 Laravel 默认的 timestamps()
  • 软删除使用 deleted_at unsigned integer,不使用 softDeletes()
  • 外键字段需要添加 index()

When not to use it

  • When working with standard Laravel migrations that require timestamps()
  • When using softDeletes() instead of custom deleted_at fields

Limitations

  • Hard-coded to use unsigned integers for all timestamps
  • Limited to the specific field types defined in the mapping table

How it compares

It enforces CatchAdmin-specific coding standards for database schema definitions, whereas standard migrations use generic Laravel defaults.

Compared to similar skills

migration side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
migration (this skill)16moNo flagsBeginner
pennant-development24moNo flagsIntermediate
extending-shopper14moNo flagsIntermediate
controller16moNo flagsBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry