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>.sqlwhere:NNNis 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:
-- Migration: NNN_<description>
-- Purpose: <one-line summary from $ARGUMENTS>
--
-- To apply: supabase db push
-- To revert: <describe manual rollback steps>
-- Add your SQL here
- 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 COLUMNwith appropriate defaults - After creating the file, show the user the full SQL and ask them to review before applying