agentsclimarketplace

Database migrations

Skill littlelingo/context-engine/skills/database-migrations

Database migration patterns and ORM conventions. Auto-loaded when working with schema changes, migrations, models, or SQL files.From its SKILL.md

Install
npx -y skills add littlelingo/context-engine --skill database-migrations

Assembled 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.
  • 1 stars1 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.

SKILL.md

1.6 KB, as published. Nobody here has run it

Database Migrations

Safety Rules

  • NEVER run destructive migrations without explicit user approval
  • Always create a rollback plan before applying migrations
  • Test migrations on a copy of production data when possible
  • Migrations must be idempotent - safe to run multiple times

Migration Checklist

  1. Write migration with both up and down (rollback)
  2. Test up migration on empty database
  3. Test down migration (verify rollback works)
  4. Test up migration on database with existing data
  5. Check for data loss - does the migration destroy existing data?
  6. Add appropriate indexes for new columns used in WHERE/JOIN
  7. Consider table locks on large tables - use concurrent index creation

Naming

  • Timestamp prefix: 20260321_add_user_roles.sql
  • Descriptive: what the migration does, not the ticket number
  • One logical change per migration file

Schema Design

  • Always include created_at and updated_at timestamps
  • Use UUIDs or ULIDs for public-facing IDs, sequential integers for internal
  • Add NOT NULL constraints by default, allow NULL only when semantically correct
  • Foreign keys with appropriate ON DELETE behavior (CASCADE, SET NULL, RESTRICT)

Common Pitfalls

  • Adding NOT NULL column without default to table with existing rows
  • Dropping columns that are still referenced in application code
  • Running migrations that lock large tables during peak traffic
  • Forgetting to update ORM models after schema changes

Keep looking

Skills are one crate of 608,666. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.