Agent Skills › NangoHQ/nango › creating-database-migrations

creating-database-migrations

GitHub

指导创建数据库迁移文件,包括定位目录、命名规范、风格对齐及外键策略。

.agents/skills/creating-database-migrations/SKILL.md NangoHQ/nango

Trigger Scenarios

需要创建新的数据库迁移文件 编辑现有的数据库迁移

Install

npx skills add NangoHQ/nango --skill creating-database-migrations -g -y
More Options

Non-standard path

npx skills add https://github.com/NangoHQ/nango/tree/master/.agents/skills/creating-database-migrations -g -y

Use without installing

npx skills use NangoHQ/nango@creating-database-migrations

指定 Agent (Claude Code)

npx skills add NangoHQ/nango --skill creating-database-migrations -a claude-code -g -y

安装 repo 全部 skill

npx skills add NangoHQ/nango --all -g -y

预览 repo 内 skill

npx skills add NangoHQ/nango --list

SKILL.md

Frontmatter
{
    "name": "creating-database-migrations",
    "description": "Use when adding or editing Nango database migrations - covers migration directory selection, timestamped .cjs naming, matching recent migration style, down migration decisions, and foreign key ON DELETE conventions."
}

Creating Database Migrations

Workflow

  1. Identify the right migration directory.

    • Main database migrations live in packages/database/lib/migrations/.
    • Other services may have their own migration directories; use the directory for the service being changed.
  2. Before writing a migration, read 2-3 recent migrations in the same directory and follow their style.

  3. Name new main database migrations with the timestamped CommonJS format:

    <YYYYMMDDHHMMSS>_<description>.cjs
    

    Example:

    20260420120000_create_customer_keys.cjs
    
  4. Decide exports.down explicitly.

    • Ask the user whether rollback logic should be included or exports.down should be left empty.
    • If the user already specified rollback behavior, follow that direction.
  5. Choose foreign key delete behavior from the relationship:

    • Use ON DELETE CASCADE for ownership relationships where the child cannot exist without the parent.
    • Use ON DELETE SET NULL for optional references where the child should survive parent deletion.
    • Check existing migrations for the closest matching relationship before choosing.

Review Checklist

  • Migration is in the correct service migration directory.
  • Filename uses the timestamped .cjs migration format.
  • Style matches recent migrations in the same directory.
  • exports.down behavior was confirmed or explicitly requested.
  • Foreign keys use CASCADE for ownership and SET NULL for optional references.

Version History

  • b75293e Current 2026-08-28 21:54

Same Skill Collection

.agents/skills/adding-audit-events/SKILL.md
.agents/skills/agent-builder-skill/SKILL.md
.agents/skills/building-and-verifying/SKILL.md
.agents/skills/creating-integration-docs/SKILL.md
.agents/skills/creating-skills-skill/SKILL.md
.agents/skills/managing-analytics-events/SKILL.md
.agents/skills/running-and-testing-locally/SKILL.md
.agents/skills/running-tests/SKILL.md
.agents/skills/ui-visual-debugging/SKILL.md

Metadata

Files
0
Version
c934467
Hash
f48b07ff
Indexed
2026-08-28 21:54

홈 - 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-20 19:55
浙ICP备14020137号-1