gpt-engineer-app[bot] commited on
Commit ·
b7e0512
1
Parent(s): a7316fa
Changes
Browse files
src/integrations/supabase/types.ts
CHANGED
|
@@ -14,57 +14,6 @@ export type Database = {
|
|
| 14 |
}
|
| 15 |
public: {
|
| 16 |
Tables: {
|
| 17 |
-
ai_call_logs: {
|
| 18 |
-
Row: {
|
| 19 |
-
attempts: number
|
| 20 |
-
base_url: string
|
| 21 |
-
created_at: string
|
| 22 |
-
duration_ms: number | null
|
| 23 |
-
endpoint: string
|
| 24 |
-
error: string | null
|
| 25 |
-
id: string
|
| 26 |
-
label: string
|
| 27 |
-
ok: boolean
|
| 28 |
-
requested_model: string
|
| 29 |
-
resolved_model: string
|
| 30 |
-
status_code: number | null
|
| 31 |
-
used_fallback: boolean
|
| 32 |
-
user_id: string | null
|
| 33 |
-
}
|
| 34 |
-
Insert: {
|
| 35 |
-
attempts?: number
|
| 36 |
-
base_url: string
|
| 37 |
-
created_at?: string
|
| 38 |
-
duration_ms?: number | null
|
| 39 |
-
endpoint: string
|
| 40 |
-
error?: string | null
|
| 41 |
-
id?: string
|
| 42 |
-
label: string
|
| 43 |
-
ok?: boolean
|
| 44 |
-
requested_model: string
|
| 45 |
-
resolved_model: string
|
| 46 |
-
status_code?: number | null
|
| 47 |
-
used_fallback?: boolean
|
| 48 |
-
user_id?: string | null
|
| 49 |
-
}
|
| 50 |
-
Update: {
|
| 51 |
-
attempts?: number
|
| 52 |
-
base_url?: string
|
| 53 |
-
created_at?: string
|
| 54 |
-
duration_ms?: number | null
|
| 55 |
-
endpoint?: string
|
| 56 |
-
error?: string | null
|
| 57 |
-
id?: string
|
| 58 |
-
label?: string
|
| 59 |
-
ok?: boolean
|
| 60 |
-
requested_model?: string
|
| 61 |
-
resolved_model?: string
|
| 62 |
-
status_code?: number | null
|
| 63 |
-
used_fallback?: boolean
|
| 64 |
-
user_id?: string | null
|
| 65 |
-
}
|
| 66 |
-
Relationships: []
|
| 67 |
-
}
|
| 68 |
incidents: {
|
| 69 |
Row: {
|
| 70 |
analysis: Json | null
|
|
@@ -79,7 +28,7 @@ export type Database = {
|
|
| 79 |
status: Database["public"]["Enums"]["incident_status"]
|
| 80 |
title: string
|
| 81 |
updated_at: string
|
| 82 |
-
user_id: string
|
| 83 |
}
|
| 84 |
Insert: {
|
| 85 |
analysis?: Json | null
|
|
@@ -94,7 +43,7 @@ export type Database = {
|
|
| 94 |
status?: Database["public"]["Enums"]["incident_status"]
|
| 95 |
title: string
|
| 96 |
updated_at?: string
|
| 97 |
-
user_id: string
|
| 98 |
}
|
| 99 |
Update: {
|
| 100 |
analysis?: Json | null
|
|
@@ -109,25 +58,7 @@ export type Database = {
|
|
| 109 |
status?: Database["public"]["Enums"]["incident_status"]
|
| 110 |
title?: string
|
| 111 |
updated_at?: string
|
| 112 |
-
user_id?: string
|
| 113 |
-
}
|
| 114 |
-
Relationships: []
|
| 115 |
-
}
|
| 116 |
-
profiles: {
|
| 117 |
-
Row: {
|
| 118 |
-
created_at: string
|
| 119 |
-
display_name: string | null
|
| 120 |
-
id: string
|
| 121 |
-
}
|
| 122 |
-
Insert: {
|
| 123 |
-
created_at?: string
|
| 124 |
-
display_name?: string | null
|
| 125 |
-
id: string
|
| 126 |
-
}
|
| 127 |
-
Update: {
|
| 128 |
-
created_at?: string
|
| 129 |
-
display_name?: string | null
|
| 130 |
-
id?: string
|
| 131 |
}
|
| 132 |
Relationships: []
|
| 133 |
}
|
|
@@ -139,7 +70,7 @@ export type Database = {
|
|
| 139 |
created_at: string
|
| 140 |
id: string
|
| 141 |
incident_id: string | null
|
| 142 |
-
user_id: string
|
| 143 |
}
|
| 144 |
Insert: {
|
| 145 |
category?: Database["public"]["Enums"]["learning_category"]
|
|
@@ -148,7 +79,7 @@ export type Database = {
|
|
| 148 |
created_at?: string
|
| 149 |
id?: string
|
| 150 |
incident_id?: string | null
|
| 151 |
-
user_id: string
|
| 152 |
}
|
| 153 |
Update: {
|
| 154 |
category?: Database["public"]["Enums"]["learning_category"]
|
|
@@ -157,7 +88,7 @@ export type Database = {
|
|
| 157 |
created_at?: string
|
| 158 |
id?: string
|
| 159 |
incident_id?: string | null
|
| 160 |
-
user_id?: string
|
| 161 |
}
|
| 162 |
Relationships: [
|
| 163 |
{
|
|
@@ -169,39 +100,14 @@ export type Database = {
|
|
| 169 |
},
|
| 170 |
]
|
| 171 |
}
|
| 172 |
-
user_roles: {
|
| 173 |
-
Row: {
|
| 174 |
-
id: string
|
| 175 |
-
role: Database["public"]["Enums"]["app_role"]
|
| 176 |
-
user_id: string
|
| 177 |
-
}
|
| 178 |
-
Insert: {
|
| 179 |
-
id?: string
|
| 180 |
-
role: Database["public"]["Enums"]["app_role"]
|
| 181 |
-
user_id: string
|
| 182 |
-
}
|
| 183 |
-
Update: {
|
| 184 |
-
id?: string
|
| 185 |
-
role?: Database["public"]["Enums"]["app_role"]
|
| 186 |
-
user_id?: string
|
| 187 |
-
}
|
| 188 |
-
Relationships: []
|
| 189 |
-
}
|
| 190 |
}
|
| 191 |
Views: {
|
| 192 |
[_ in never]: never
|
| 193 |
}
|
| 194 |
Functions: {
|
| 195 |
-
|
| 196 |
-
Args: {
|
| 197 |
-
_role: Database["public"]["Enums"]["app_role"]
|
| 198 |
-
_user_id: string
|
| 199 |
-
}
|
| 200 |
-
Returns: boolean
|
| 201 |
-
}
|
| 202 |
}
|
| 203 |
Enums: {
|
| 204 |
-
app_role: "admin" | "operator"
|
| 205 |
incident_severity: "low" | "medium" | "high" | "critical" | "unknown"
|
| 206 |
incident_status: "pending" | "analyzing" | "complete" | "failed"
|
| 207 |
learning_category: "correction" | "insight" | "error" | "best_practice"
|
|
@@ -333,7 +239,6 @@ export type CompositeTypes<
|
|
| 333 |
export const Constants = {
|
| 334 |
public: {
|
| 335 |
Enums: {
|
| 336 |
-
app_role: ["admin", "operator"],
|
| 337 |
incident_severity: ["low", "medium", "high", "critical", "unknown"],
|
| 338 |
incident_status: ["pending", "analyzing", "complete", "failed"],
|
| 339 |
learning_category: ["correction", "insight", "error", "best_practice"],
|
|
|
|
| 14 |
}
|
| 15 |
public: {
|
| 16 |
Tables: {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
incidents: {
|
| 18 |
Row: {
|
| 19 |
analysis: Json | null
|
|
|
|
| 28 |
status: Database["public"]["Enums"]["incident_status"]
|
| 29 |
title: string
|
| 30 |
updated_at: string
|
| 31 |
+
user_id: string | null
|
| 32 |
}
|
| 33 |
Insert: {
|
| 34 |
analysis?: Json | null
|
|
|
|
| 43 |
status?: Database["public"]["Enums"]["incident_status"]
|
| 44 |
title: string
|
| 45 |
updated_at?: string
|
| 46 |
+
user_id?: string | null
|
| 47 |
}
|
| 48 |
Update: {
|
| 49 |
analysis?: Json | null
|
|
|
|
| 58 |
status?: Database["public"]["Enums"]["incident_status"]
|
| 59 |
title?: string
|
| 60 |
updated_at?: string
|
| 61 |
+
user_id?: string | null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
Relationships: []
|
| 64 |
}
|
|
|
|
| 70 |
created_at: string
|
| 71 |
id: string
|
| 72 |
incident_id: string | null
|
| 73 |
+
user_id: string | null
|
| 74 |
}
|
| 75 |
Insert: {
|
| 76 |
category?: Database["public"]["Enums"]["learning_category"]
|
|
|
|
| 79 |
created_at?: string
|
| 80 |
id?: string
|
| 81 |
incident_id?: string | null
|
| 82 |
+
user_id?: string | null
|
| 83 |
}
|
| 84 |
Update: {
|
| 85 |
category?: Database["public"]["Enums"]["learning_category"]
|
|
|
|
| 88 |
created_at?: string
|
| 89 |
id?: string
|
| 90 |
incident_id?: string | null
|
| 91 |
+
user_id?: string | null
|
| 92 |
}
|
| 93 |
Relationships: [
|
| 94 |
{
|
|
|
|
| 100 |
},
|
| 101 |
]
|
| 102 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
}
|
| 104 |
Views: {
|
| 105 |
[_ in never]: never
|
| 106 |
}
|
| 107 |
Functions: {
|
| 108 |
+
[_ in never]: never
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
}
|
| 110 |
Enums: {
|
|
|
|
| 111 |
incident_severity: "low" | "medium" | "high" | "critical" | "unknown"
|
| 112 |
incident_status: "pending" | "analyzing" | "complete" | "failed"
|
| 113 |
learning_category: "correction" | "insight" | "error" | "best_practice"
|
|
|
|
| 239 |
export const Constants = {
|
| 240 |
public: {
|
| 241 |
Enums: {
|
|
|
|
| 242 |
incident_severity: ["low", "medium", "high", "critical", "unknown"],
|
| 243 |
incident_status: ["pending", "analyzing", "complete", "failed"],
|
| 244 |
learning_category: ["correction", "insight", "error", "best_practice"],
|
supabase/migrations/20260508073728_cdb759d6-088c-4557-9a14-13f862317d69.sql
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
-- Drop dependent triggers/functions tied to auth
|
| 3 |
+
drop trigger if exists on_auth_user_created on auth.users;
|
| 4 |
+
drop function if exists public.handle_new_user() cascade;
|
| 5 |
+
|
| 6 |
+
-- Drop tables that exist solely for auth/roles/logging-per-user
|
| 7 |
+
drop table if exists public.ai_call_logs cascade;
|
| 8 |
+
drop table if exists public.user_roles cascade;
|
| 9 |
+
drop table if exists public.profiles cascade;
|
| 10 |
+
drop function if exists public.has_role(uuid, app_role) cascade;
|
| 11 |
+
drop type if exists public.app_role cascade;
|
| 12 |
+
|
| 13 |
+
-- Detach incidents from auth.users and disable RLS
|
| 14 |
+
alter table public.incidents disable row level security;
|
| 15 |
+
drop policy if exists "incidents owner read" on public.incidents;
|
| 16 |
+
drop policy if exists "incidents owner insert" on public.incidents;
|
| 17 |
+
drop policy if exists "incidents owner update" on public.incidents;
|
| 18 |
+
drop policy if exists "incidents owner delete" on public.incidents;
|
| 19 |
+
alter table public.incidents drop constraint if exists incidents_user_id_fkey;
|
| 20 |
+
alter table public.incidents alter column user_id drop not null;
|
| 21 |
+
|
| 22 |
+
-- Same for qwen_learnings
|
| 23 |
+
alter table public.qwen_learnings disable row level security;
|
| 24 |
+
drop policy if exists "learnings owner read" on public.qwen_learnings;
|
| 25 |
+
drop policy if exists "learnings owner insert" on public.qwen_learnings;
|
| 26 |
+
drop policy if exists "learnings owner delete" on public.qwen_learnings;
|
| 27 |
+
alter table public.qwen_learnings drop constraint if exists qwen_learnings_user_id_fkey;
|
| 28 |
+
alter table public.qwen_learnings alter column user_id drop not null;
|