Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)81k · #1658

migrate-create

Skill này làm gì

Skill này tạo một migration cơ sở dữ liệu có đánh số mới, gồm file tiến và file hoàn tác. Nó dành cho lập trình viên thay đổi schema cơ sở dữ liệu một cách có tổ chức.

Khi nào nên dùng

  • ✓Khi bạn cần thêm một bảng, cột hoặc chỉ mục vào cơ sở dữ liệu.
  • ✓Khi bạn muốn có file hoàn tác tương ứng cho mỗi thay đổi.
  • ✓Khi bạn muốn số migration tiếp theo được chọn tự động.

Liên kết skill

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-migrations/skills/migrate-create/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-migrations/skills/migrate-create/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy tạo một migration thêm cột due date vào bảng tasks, kèm file hoàn tác của nó.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill tìm số lớn nhất hiện có, cộng thêm một và chọn template dựa trên phần đầu của tên, như create, add hoặc drop. Nó ghi các file SQL tiến và hoàn tác rồi ghi lại migration.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Migrate Create

Generate a new database migration with sequential numbering and up/down SQL file pair.

When to use

When you need to create a new database migration for schema changes such as creating tables, adding columns, creating indexes, or modifying constraints.

Steps

  1. Determine next number -- use Glob to scan the migrations directory for existing migration files and find the highest number, then increment by 1 (zero-pad to 3 digits)
  2. Select template -- based on the <name>, choose the appropriate SQL template:
    • Names starting with create_ -> CREATE TABLE template
    • Names starting with add_ -> ALTER TABLE ADD COLUMN template
    • Names starting with drop_ -> DROP with safety checks
    • Names containing index -> CREATE INDEX template
    • Other -> generic migration template with placeholder comments
  3. Generate up migration -- write NNN_<name>.up.sql with the appropriate SQL using IF NOT EXISTS for idempotency
  4. Generate down migration -- write NNN_<name>.down.sql with the reverse operation using IF EXISTS
  5. Search past patterns -- call mcp__plugin_ruflo-core_ruflo__agentdb_pattern-search (ReasoningBank-routed; don't pass a namespace argument — pattern-* tools ignore it).
  6. Store metadata -- call mcp__plugin_ruflo-core_ruflo__memory_store --namespace migrations to record the migration with number, name, status (pending), and file paths. The memory_* tool family routes by namespace; agentdb_hierarchical-* does NOT (it routes by tier working|episodic|semantic), so use memory_* here. See ruflo-agentdb ADR-0001 §"Namespace convention".
  7. Report -- display: migration number, file paths created, template used, any similar past migrations found

CLI alternative

npx @claude-flow/cli@latest memory store --namespace migrations --key "migration-NNN_NAME" --value '{"number": NNN, "name": "NAME", "status": "pending"}'
Câu hỏi thường gặp

Template được chọn thế nào?

Phần đầu của tên quyết định. Tên bắt đầu bằng create, add hoặc drop có template riêng, còn tên có chứa index sẽ dùng template chỉ mục.

Skill có chạy migration không?

Mô tả nói đến việc tạo file và ghi metadata. Nó không nói migration đã được áp dụng.

Nó có kiểm tra SQL không?

Skill migrate validate riêng biệt sẽ kiểm tra các migration đang chờ về mức độ an toàn.

Chi tiết

Mô tả gốc của tác giả

Create a new sequentially numbered database migration with up/down SQL files

repo: ruvnet/ruflo

Độ phổ biến

Sao GitHub
81k
Vị trí xếp hạng
#1658
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự