Tambahkan pada file .env (frontend):
VITE_SUPABASE_URL=https://zursrnbabevivnpzuuvc.supabase.co
VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
profilescreate table public.profiles (
id uuid not null,
full_name text null,
email text null,
role text not null default 'admin'::text,
avatar_url text null,
created_at timestamp with time zone null default now(),
updated_at timestamp with time zone null default now(),
gender text null,
phone text null,
address text null,
note text null,
employee_code text null,
created_by uuid null,
constraint profiles_pkey primary key (id),
constraint profiles_created_by_fkey foreign KEY (created_by) references auth.users (id) on delete set null,
constraint profiles_id_fkey foreign KEY (id) references auth.users (id) on delete CASCADE
) TABLESPACE pg_default;
CREATE OR REPLACE FUNCTION public.handle_new_auth_user()
RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
INSERT INTO public.profiles (id, email)
VALUES (NEW.id, NEW.email);
RETURN NEW;
END;
$$;
alter table public.profiles enable row level security;
drop view if exists public.view_profiles cascade;
create or replace function public.get_view_profiles()
returns setof public.profiles
language sql
security invoker
set row_security = on
as $$
select *
from public.profiles;
$$;
profiles