andershi666/lobehub-hr-demo/db-migrations
Claude Code and agent skill by andershi666/lobehub-hr-demo
- community
Checking that the SKILL.md file is still in the repository.
Use when generating or regenerating Drizzle migration files, changing database schema tables or columns, resolving migration sequence conflicts after rebase, reviewing migration SQL for idempotent patterns, or renaming migration files.
Install
npx vskill@latest install andershi666/lobehub-hr-demo/db-migrationsSKILL.md
The same SKILL.md was published earlier as yyc-cube/yyc3-knowledge-base/db-migrations.
Database Migrations Guide
Step 1: Generate Migrations
This generates:
packages/database/migrations/0046_meaningless_file_name.sql
And updates:
packages/database/migrations/meta/_journal.jsonpackages/database/src/core/migrations.jsondocs/development/database-schema.dbml
Custom Migrations (e.g. CREATE EXTENSION)
For migrations that don't involve Drizzle schema changes (e.g. enabling PostgreSQL extensions), use the --custom flag:
This generates an empty SQL file and properly updates _journal.json and snapshot. Then edit the generated SQL file to add your custom SQL:
Do NOT manually create migration files or edit `_journal.json` — always use drizzle-kit generate to ensure correct journal entries and snapshots.
Step 2: Optimize Migration SQL Filename
Rename auto-generated filename to be meaningful:
0046_meaningless_file_name.sql → 0046_user_add_avatar_column.sql
Step 3: Use Idempotent Clauses (Defensive Programming)
Always use defensive clauses to make migrations idempotent (safe to re-run):
CREATE TABLE
ALTER TABLE - Columns
ALTER TABLE - Foreign Key Constraints
PostgreSQL has no ADD CONSTRAINT IF NOT EXISTS. Use DROP IF EXISTS + ADD:
DROP TABLE / INDEX
Step 4: Update Journal Tag
After renaming the migration SQL file in Step 2, update the tag field in packages/database/migrations/meta/_journal.json to match the new filename (without .sql extension).
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinglobehub/.agents/skills/db-migrations/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/andershi666/lobehub-hr-demo/db-migrations)