Live demo of the Whirlwind template, as shippedStripe test mode: card 4242 4242 4242 4242, any future date, any CVCGet Whirlwind →

Migrations

How setup applies the numbered SQL files, and how to add 006.

How they are applied

npm run setup applies all pending migrations in order. You can also paste a file into the Supabase SQL editor. npm run doctor reports which have been applied. There is no Supabase CLI dependency.

Add one

Migrations are numbered SQL files. The template ships 001 to 007, so the next is 008. The skill includes a template at skills/whirlwind/templates/migration.sql.
-- lib/supabase/migrations/008_add_projects_table.sql
create table if not exists public.projects (
  id uuid primary key default gen_random_uuid(),
  user_id uuid references public.users(id) on delete cascade not null,
  name text not null,
  created_at timestamptz not null default timezone('utc', now())
);

alter table public.projects enable row level security;

create policy "own projects" on public.projects
  for all using (user_id = (select id from public.users where auth_user_id = auth.uid()));
💡

Rows key on public.users.id, not auth.uid() directly. The policy above maps between them.

Verify

npm run setup      # applies 008
npm run doctor     # confirms the table exists
npm run audit      # catches a table without RLS