database-migrationslisted
Install: claude install-skill ColdBox/skills
# Database Migrations Skill
## When to Use This Skill
Load this skill when:
- Creating or altering schema with versioned migration files
- Writing migration `up()`/`down()` logic with Schema Builder
- Running migrations from CommandBox in local/dev/CI pipelines
- Seeding baseline or test data
- Rolling back schema changes safely
## Installation
```bash
box install commandbox-migrations
```
## Core Configuration
### `config/ColdBox.cfc`
```boxlang
moduleSettings = {
cfmigrations: {
manager: "cfmigrations.models.QBMigrationManager",
migrationsDirectory: "/resources/database/migrations/",
seedsDirectory: "/resources/database/seeds/",
properties: {
defaultGrammar: "MySQLGrammar@qb",
datasource: "appDB"
}
}
}
```
### Optional `.cfmigrations`
```json
{
"default": {
"driver": "MySQL",
"host": "${DB_HOST}",
"port": "${DB_PORT:3306}",
"database": "${DB_DATABASE}",
"username": "${DB_USERNAME}",
"password": "${DB_PASSWORD}",
"migrationsTable": "cfmigrations",
"migrationsDirectory": "resources/database/migrations"
}
}
```
## CLI Workflow
```bash
# One-time setup
box migrate install
# Create migration
box migrate create create_users_table
# Run / rollback
box migrate up
box migrate down
box migrate reset
box migrate refresh
# Seed and inspect
box migrate seed
box migrate status
```
## Migration Shape
```cfml
component {
function up( schema, q