create table if not exists contacts (
  id uuid default gen_random_uuid() primary key,
  user_id uuid references auth.users(id) on delete cascade,
  name text not null,
  phone text not null,
  avatar_url text,
  created_at timestamp default now()
);

alter table contacts enable row level security;

create policy "Users see own contacts"
on contacts for select
using (auth.uid() = user_id);

create policy "Users insert own contacts"
on contacts for insert
with check (auth.uid() = user_id);

create policy "Users delete own contacts"
on contacts for delete
using (auth.uid() = user_id);
