mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
183fe0a93c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
30 lines
1.2 KiB
SQL
30 lines
1.2 KiB
SQL
|
|
CREATE TABLE public.forte_account_mappings (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
association_id UUID REFERENCES public.associations(id) ON DELETE CASCADE,
|
|
organization_id TEXT NOT NULL,
|
|
location_id TEXT NOT NULL,
|
|
api_access_id TEXT NOT NULL,
|
|
api_secure_key TEXT,
|
|
is_active BOOLEAN NOT NULL DEFAULT true,
|
|
pass_processing_fee BOOLEAN NOT NULL DEFAULT false,
|
|
processing_fee_percent NUMERIC NOT NULL DEFAULT 0.029,
|
|
processing_fee_fixed_cents INTEGER NOT NULL DEFAULT 30,
|
|
label TEXT,
|
|
environment TEXT NOT NULL DEFAULT 'sandbox',
|
|
created_by UUID,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
ALTER TABLE public.forte_account_mappings ENABLE ROW LEVEL SECURITY;
|
|
|
|
CREATE POLICY "Authenticated users can view forte mappings"
|
|
ON public.forte_account_mappings FOR SELECT TO authenticated
|
|
USING (true);
|
|
|
|
CREATE POLICY "Admins can manage forte mappings"
|
|
ON public.forte_account_mappings FOR ALL TO authenticated
|
|
USING (public.has_role(auth.uid(), 'admin') OR public.has_role(auth.uid(), 'manager'))
|
|
WITH CHECK (public.has_role(auth.uid(), 'admin') OR public.has_role(auth.uid(), 'manager'));
|