-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathsupabase.sql
More file actions
33 lines (28 loc) · 1020 Bytes
/
supabase.sql
File metadata and controls
33 lines (28 loc) · 1020 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
27
28
29
30
31
32
33
-- 建表
create table public.user_configs (
id bigint generated by default as identity not null,
created_at timestamp with time zone not null default now(),
data json null,
updated_at text null,
user_id uuid not null,
constraint user_configs_pkey primary key (id),
constraint user_configs_user_id_key unique (user_id)
) TABLESPACE pg_default;
-- 启用行级安全(RLS)
alter table public.user_configs enable row level security;
drop policy if exists "user_configs_select_own" on public.user_configs;
drop policy if exists "user_configs_insert_own" on public.user_configs;
drop policy if exists "user_configs_update_own" on public.user_configs;
create policy "user_configs_select_own"
on public.user_configs
for select
using (auth.uid() = user_id);
create policy "user_configs_insert_own"
on public.user_configs
for insert
with check (auth.uid() = user_id);
create policy "user_configs_update_own"
on public.user_configs
for update
using (auth.uid() = user_id)
with check (auth.uid() = user_id);