Handle local database schema changes with Drizzle and PlanetScale. Use when making schema changes to src/db/schema.ts, adding/modifying database tables or columns, or when asked about database migrations. Covers the push-based local development workflow and when to generate migrations.
Installation
Details
Usage
After installing, this skill will be available to your AI coding assistant.
Verify installation:
npx agent-skills-cli listSkill Instructions
name: local-db description: Handle local database schema changes with Drizzle and PlanetScale. Use when making schema changes to src/db/schema.ts, adding/modifying database tables or columns, or when asked about database migrations. Covers the push-based local development workflow and when to generate migrations.
Local Database Workflow
This project uses a push-based workflow for local development to avoid migration file conflicts.
Local Development: Use db:push
When making schema changes during development:
# 1. Edit src/db/schema.ts
# 2. Push changes directly to PlanetScale dev branch
pnpm db:push
This applies schema changes directly without generating migration files. No _journal.json conflicts.
When to Generate Migrations
Generate migrations only when ready to merge to main:
# 1. Sync with main first
git fetch origin main
git rebase origin/main
# 2. Reset local DB to match main's migrations (if needed)
pnpm db:setup-local
# 3. Generate a single migration for all schema changes
pnpm db:generate --name=your-feature-name
# 4. Apply locally to verify
pnpm db:migrate:local
# 5. Commit migration files and merge
Key Commands
| Command | When to Use |
|---|---|
pnpm db:push | Local development - apply schema changes |
pnpm db:generate --name=X | Before merging - create migration file |
pnpm db:migrate:local | Apply migrations locally |
pnpm db:studio | Browse local database |
Important Notes
- Never commit migrations during active development - only at merge time
- Always rebase/merge main before generating - prevents
_journal.jsonconflicts - One migration per feature - consolidates changes into a single file
- Test migrations locally - run
db:migrate:localbefore pushing - CI/CD handles production - never run migrations manually against prod
More by wodsmith
View allDocumentation guidance for competition athletes and volunteers in WODsmith. Use when writing, reviewing, or improving athlete-facing documentation including registration, scheduling, workout viewing, leaderboards, check-in, and volunteer coordination.
Implement drag and drop using @atlaskit/pragmatic-drag-and-drop. Use when implementing sortable lists, reorderable items, kanban boards, or any drag-drop interactions. Covers draggable setup, drop targets, edge detection, drag previews, and critical state management patterns to avoid performance issues.
Fix type assertions and improve TypeScript type safety. Use when encountering 'as unknown as' casts, manual type definitions that duplicate schema types, or unclear type errors in database queries, especially with Drizzle ORM relations. Also use when verifying types
Guide for working with team-based permissions and authorization in the WODsmith codebase. Use when touching TEAM_PERMISSIONS constants, hasTeamPermission/requireTeamPermission functions, adding permission checks to actions or server functions, creating features requiring authorization, or ensuring client-server permission consistency.
