Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
cfef9d1686
commit
e56099780e
@@ -0,0 +1,24 @@
|
||||
CREATE TABLE public.import_runs (
|
||||
id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
|
||||
importer_key text NOT NULL,
|
||||
total integer NOT NULL DEFAULT 0,
|
||||
inserted integer NOT NULL DEFAULT 0,
|
||||
skipped integer NOT NULL DEFAULT 0,
|
||||
error_count integer NOT NULL DEFAULT 0,
|
||||
ran_by uuid,
|
||||
ran_at timestamptz NOT NULL DEFAULT now(),
|
||||
created_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX idx_import_runs_key_ran_at ON public.import_runs (importer_key, ran_at DESC);
|
||||
|
||||
ALTER TABLE public.import_runs ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
CREATE POLICY "import_runs_select_auth" ON public.import_runs
|
||||
FOR SELECT TO authenticated USING (true);
|
||||
|
||||
CREATE POLICY "import_runs_insert_auth" ON public.import_runs
|
||||
FOR INSERT TO authenticated WITH CHECK (auth.uid() IS NOT NULL);
|
||||
|
||||
CREATE POLICY "import_runs_delete_admin" ON public.import_runs
|
||||
FOR DELETE TO authenticated USING (public.is_admin(auth.uid()));
|
||||
Reference in New Issue
Block a user