Files
real-time-fund/supabase.sql
2026-02-08 22:37:54 +08:00

34 lines
1020 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 建表
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);