vkc-drizzle-schema-migration

LEE-SANG-BOK's avatarfrom LEE-SANG-BOK

Standardize Drizzle schema/migration/seed workflow for Viet K-Connect. Use when adding or changing DB tables, especially DB-driven visa rulesets and document templates (no hardcoding).

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 4, 2026

When & Why to Use This Skill

This Claude skill standardizes the Drizzle ORM workflow for database management, focusing on schema definitions, automated migrations, and data seeding. It is specifically designed to transition hardcoded logic into dynamic, DB-driven configurations, ensuring architectural consistency and scalability for complex applications. By enforcing strict rules for schema updates and migration generation, it minimizes manual errors and streamlines the development lifecycle.

Use Cases

  • Schema Evolution: Efficiently add or modify database tables, enums, and indexes within the Drizzle ORM framework while maintaining a single source of truth.
  • Automated Migration Management: Streamline the generation and application of SQL migrations using drizzle-kit to ensure consistency across development and production environments.
  • Dynamic Configuration Management: Convert hardcoded business logic, such as visa rulesets and document templates, into manageable database entries to allow for real-time updates without code changes.
  • Database Seeding: Automate the population of essential project data, regulation snapshots, and test datasets through standardized seeding scripts.
namevkc-drizzle-schema-migration
descriptionStandardize Drizzle schema/migration/seed workflow for Viet K-Connect. Use when adding or changing DB tables, especially DB-driven visa rulesets and document templates (no hardcoding).
short-descriptionDrizzle schema + migration workflow

VKC Drizzle Schema & Migration

When to use

  • Adding/updating DB tables/enums/indexes
  • Introducing DB-driven configuration (visa rulesets, doc templates, regulation snapshots)

Hard rules

  • DB schema lives in src/lib/db/schema.ts.
  • Migrations are generated/applied via drizzle-kit (npm run db:generate, npm run db:migrate).
  • Visa rulesets and doc templates MUST be DB tables, not hardcoded TS objects.
  • Coordinate ownership: src/lib/db/schema.ts and src/lib/db/migrations/** should not be modified concurrently by multiple agents.

Workflow

  1. Update src/lib/db/schema.ts
  • Add table(s), enum(s), indexes.
  • Prefer explicit indexes for (userId, createdAt) where rate limits depend on time windows.
  1. Generate migration
  • npm run db:generate
  1. Apply migration locally (if DB configured)
  • npm run db:migrate
  1. Seed (if needed)
  • Use npm run db:seed or project seed scripts.

References

  • Rules & examples: .codex/skills/vkc-drizzle-schema-migration/references/drizzle-rules.md