Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-19 01:08:31 +00:00
co-authored by renee-png
parent cfef9d1686
commit e56099780e
2 changed files with 60 additions and 0 deletions
+36
View File
@@ -1771,6 +1771,42 @@ export type Database = {
}
Relationships: []
}
import_runs: {
Row: {
created_at: string
error_count: number
id: string
importer_key: string
inserted: number
ran_at: string
ran_by: string | null
skipped: number
total: number
}
Insert: {
created_at?: string
error_count?: number
id?: string
importer_key: string
inserted?: number
ran_at?: string
ran_by?: string | null
skipped?: number
total?: number
}
Update: {
created_at?: string
error_count?: number
id?: string
importer_key?: string
inserted?: number
ran_at?: string
ran_by?: string | null
skipped?: number
total?: number
}
Relationships: []
}
incoming_emails: {
Row: {
attachment_count: number
@@ -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()));