feat(MED-100): update cart checkout flow and views
This commit is contained in:
27
supabase/migrations/20250717075136_audit_cart.sql
Normal file
27
supabase/migrations/20250717075136_audit_cart.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
create table "audit"."cart_entries" (
|
||||
"id" bigint generated by default as identity not null,
|
||||
"account_id" text not null,
|
||||
"cart_id" text not null,
|
||||
"operation" text not null,
|
||||
"variant_id" text,
|
||||
"comment" text,
|
||||
"created_at" timestamp with time zone not null default now(),
|
||||
"changed_by" uuid not null
|
||||
);
|
||||
|
||||
grant usage on schema audit to authenticated;
|
||||
grant select, insert, update, delete on table audit.cart_entries to authenticated;
|
||||
|
||||
alter table "audit"."cart_entries" enable row level security;
|
||||
|
||||
create policy "insert_own"
|
||||
on "audit"."cart_entries"
|
||||
as permissive
|
||||
for insert
|
||||
to authenticated
|
||||
with check (auth.uid() = changed_by);
|
||||
|
||||
create policy "service_role_select" on "audit"."cart_entries" for select to service_role using (true);
|
||||
create policy "service_role_insert" on "audit"."cart_entries" for insert to service_role with check (true);
|
||||
create policy "service_role_update" on "audit"."cart_entries" for update to service_role using (true);
|
||||
create policy "service_role_delete" on "audit"."cart_entries" for delete to service_role using (true);
|
||||
Reference in New Issue
Block a user