mirror of
https://git.coastit.co.za/caitlin/CRM_ENVR.git
synced 2026-07-10 19:17:16 +02:00
23 lines
590 B
SQL
23 lines
590 B
SQL
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);
|