| name | db-migrate |
| description | Scaffold a new Supabase migration file with the correct naming convention. Usage: /db-migrate <description> |
Create a new Supabase database migration for: $ARGUMENTS
Rules
- NEVER edit existing migration files in
supabase/migrations/ — always create a new one
- Read the existing migrations to understand the current schema before writing SQL
Steps
- List files in
supabase/migrations/ to determine the next sequence number (format: NNN)
- 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
- Create the migration file with this template:
- Fill in the SQL based on the description in
$ARGUMENTS
- If the migration adds a table, include RLS policies (this project enforces RLS on all tables)
- If the migration adds columns, use
ALTER TABLE ... ADD COLUMN with appropriate defaults
- After creating the file, show the user the full SQL and ask them to review before applying