Files
acmcc/supabase/migrations/20260319173005_1e43fd37-7fff-458a-b96f-906721c0b69f.sql
2026-06-01 20:19:26 -04:00

26 lines
849 B
SQL

CREATE TABLE public.migration_field_mappings (
id UUID NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
mapping_type TEXT NOT NULL CHECK (mapping_type IN ('table', 'column', 'id_value')),
source_table TEXT,
destination_table TEXT,
source_field TEXT,
destination_field TEXT,
source_value TEXT,
destination_value TEXT,
description TEXT,
is_active BOOLEAN NOT NULL DEFAULT true,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
created_by UUID REFERENCES auth.users(id)
);
ALTER TABLE public.migration_field_mappings ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Admins can manage migration mappings"
ON public.migration_field_mappings
FOR ALL
TO authenticated
USING (public.has_role(auth.uid(), 'admin'))
WITH CHECK (public.has_role(auth.uid(), 'admin'));