-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupabase-schema.sql
More file actions
26 lines (22 loc) · 804 Bytes
/
Copy pathsupabase-schema.sql
File metadata and controls
26 lines (22 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
create table if not exists public.command_history (
id uuid primary key default gen_random_uuid(),
user_id uuid not null,
command text not null,
current_dir text not null default '/',
risk_score int not null check (risk_score >= 0 and risk_score <= 100),
decision text not null,
badge text not null,
analysis jsonb not null,
created_at timestamptz not null default now()
);
create index if not exists idx_command_history_user_created_at
on public.command_history (user_id, created_at desc);
alter table public.command_history enable row level security;
create policy "Users can read own history"
on public.command_history
for select
using (auth.uid() = user_id);
create policy "Users can insert own history"
on public.command_history
for insert
with check (auth.uid() = user_id);