Database migrations
Collection of skills for the ColdBox Platform and Claude Plugin
npx -y skills add ColdBox/skills --skill database-migrationsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use this skill when managing database schema changes in ColdBox/BoxLang using cfmigrations and commandbox-migrations. Covers migration file structure, Schema Builder API, seeding, and CLI workflows for creating, running, and rolling back migrations safely.
SKILL.md
3.0 KB, 646 tokens by cl100k_base, as published. Nobody here has run it
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
box install commandbox-migrations
Core Configuration
config/ColdBox.cfc
moduleSettings = {
cfmigrations: {
manager: "cfmigrations.models.QBMigrationManager",
migrationsDirectory: "/resources/database/migrations/",
seedsDirectory: "/resources/database/seeds/",
properties: {
defaultGrammar: "MySQLGrammar@qb",
datasource: "appDB"
}
}
}
Optional .cfmigrations
{
"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
# 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
component {
function up( schema, query ) {
schema.create( "users", ( table ) => {
table.increments( "id" )
table.string( "email" ).unique()
table.string( "password" )
table.boolean( "isActive" ).default( true )
table.timestamps()
} )
}
function down( schema, query ) {
schema.drop( "users" )
}
}
Common Schema Operations
schema.create( "posts", ( table ) => {
table.increments( "id" )
table.unsignedInteger( "userId" )
table.string( "title" )
table.longText( "body" ).nullable()
table.timestamps()
table.index( "userId" )
table.foreignKey( "userId" ).references( "id" ).onTable( "users" ).onDelete( "CASCADE" )
} )
schema.alter( "posts", ( table ) => {
table.addColumn( table.string( "slug" ).unique() )
table.renameColumn( "body", "content" )
} )
Best Practices
- Use one logical change per migration
- Always implement
down()and verify rollback locally - Never edit deployed migrations; add a new migration instead
- Use env vars for credentials and avoid destructive commands in production
- Use
box migrate up(not reset/refresh) in production deployments
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 0 of the 12 instructions most databases sql skills give in 646 tokens
Counted across 589 of the 662 authors here whose files we hold, read 2026-08-07
- Use parameterized queriesin 37 of 589, across 34 files
- Use timestamptz for timestampsin 30 of 589, across 14 files
- Index foreign keysin 29 of 589, across 18 files
- Create indexes concurrentlyin 29 of 589, across 24 files
- Use numeric type for moneyin 25 of 589, across 8 files
- Use cursor pagination instead of offsetin 24 of 589, across 17 files
- Select only required columnsin 24 of 589, across 20 files
- Add indexes manually on foreign key columnsin 22 of 589, across 12 files
- Normalize to third normal formin 19 of 589, across 10 files
- Configure connection poolingin 19 of 589, across 17 files
- Put equality columns before range columns in indexesin 18 of 589, across 10 files
- Read individual rule files for detailed explanationsin 18 of 589, across 4 files
Said here and by no other author read
- install commandbox-migrations
- implement the down method
- verify rollback locally
- avoid destructive commands in production
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.