Skip to content
Back to skills

Db Design

ASecurity

Quy tắc thiết kế thay đổi DB - bảng, cột, index, migration an toàn và rollback.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 10, 2026
development

Security analysis

A100/100

Scanned October 10, 2026

npx -y skills add vannt-dev/aiws-factory --skill db-design --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Db Design?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Db Design
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vannt-dev-db-design/badge)](https://www.skillsdirectory.com/skills/vannt-dev-db-design)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: db-design
description: Quy tắc thiết kế thay đổi DB - bảng, cột, index, migration an toàn và rollback.
---

# DB design

- Theo công cụ migration đang dùng (aiws/knowledge/db-schema.md, mục Migration). Không đổi công cụ.
- Migration chỉ tiến, có rollback mô tả được. Không sửa migration đã chạy.
- Thêm cột NOT NULL vào bảng có dữ liệu: thêm nullable -> backfill -> đặt NOT NULL (hoặc có default).
- Đổi tên/xoá cột: tách nhiều bước để bản code cũ và mới cùng chạy được (expand/contract).
- Index cho cột dùng trong WHERE/JOIN mới; unique constraint cho ràng buộc nghiệp vụ.
- Quan hệ n-n dùng bảng nối (vd. `user_roles`) thay vì cột chuỗi phân tách.
- Mọi thay đổi schema liệt kê trong "DB change" và "Quyết định cần duyệt" của 02-design.md.
- Không đọc/ghi DB thật trong unit test; dùng repository giả hoặc DB in-memory theo convention dự án.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.