mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 09:50:01 +00:00
183fe0a93c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
849 B
SQL
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'));
|