# DB Migrate

> Create a new Supabase database migration for: $ARGUMENTS

- Skill: `neonwatty/db-migrate` (Agent Skill)
- Install (CLI): `npx skillmds@latest add neonwatty/db-migrate`
- Raw SKILL.md: https://api.skillmd.com/api/skills/neonwatty/db-migrate/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: neonwatty (https://skillmd.com/u/neonwatty)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/neonwatty/db-migrate

---


Create a new Supabase database migration for: $ARGUMENTS

## Rules

1. NEVER edit existing migration files in `supabase/migrations/` — always create a new one
2. Read the existing migrations to understand the current schema before writing SQL

## Steps

1. List files in `supabase/migrations/` to determine the next sequence number (format: `NNN`)
2. Generate a filename: `supabase/migrations/NNN_<description>.sql` where:
   - `NNN` is the next zero-padded 3-digit number (e.g., `010`, `011`)
   - `<description>` is derived from `$ARGUMENTS`, lowercased, spaces replaced with underscores, alphanumeric only
3. Create the migration file with this template:

```sql
-- Migration: NNN_<description>
-- Purpose: <one-line summary from $ARGUMENTS>
--
-- To apply: supabase db push
-- To revert: <describe manual rollback steps>

-- Add your SQL here
```

4. Fill in the SQL based on the description in `$ARGUMENTS`
5. If the migration adds a table, include RLS policies (this project enforces RLS on all tables)
6. If the migration adds columns, use `ALTER TABLE ... ADD COLUMN` with appropriate defaults
7. After creating the file, show the user the full SQL and ask them to review before applying

