gigafibre-fsm/apps/website/supabase/migrations/20260214163713_306ec290-f57c-4053-95d0-03e37a20aa5a.sql
louispaulb 6620652900 merge: import site-web-targo into apps/website/ (4 commits preserved)
Integrates www.gigafibre.ca (React/Vite) into the monorepo.
Full git history accessible via `git log -- apps/website/`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 08:09:15 -04:00

27 lines
943 B
SQL

-- Table to persist import job progress across browser sessions
CREATE TABLE public.import_jobs (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
type text NOT NULL CHECK (type IN ('addresses', 'fiber')),
source_url text,
status text NOT NULL DEFAULT 'running' CHECK (status IN ('running', 'done', 'error', 'paused')),
skip_rows integer NOT NULL DEFAULT 0,
total_inserted integer NOT NULL DEFAULT 0,
total_errors integer NOT NULL DEFAULT 0,
error_messages text[] DEFAULT '{}',
logs text[] DEFAULT '{}',
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now(),
user_id uuid NOT NULL
);
ALTER TABLE public.import_jobs ENABLE ROW LEVEL SECURITY;
-- Only admins can access import jobs
CREATE POLICY "Admins can manage import_jobs"
ON public.import_jobs
FOR ALL
TO authenticated
USING (public.has_role(auth.uid(), 'admin'))
WITH CHECK (public.has_role(auth.uid(), 'admin'));