File size: 1,024 Bytes
faf8398
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
-- Create a key-value state table for this frontend app.
-- Run this in Supabase SQL Editor.

create table if not exists public.app_state (
    state_key text primary key,
    payload jsonb not null default '{}'::jsonb,
    updated_at timestamptz not null default now()
);

alter table public.app_state enable row level security;

-- Allow authenticated and anonymous clients with anon key to read/write app state.
-- For production hardening, replace these policies with stricter rules.
drop policy if exists "app_state_read_all" on public.app_state;
create policy "app_state_read_all"
    on public.app_state
    for select
    using (true);

drop policy if exists "app_state_insert_all" on public.app_state;
create policy "app_state_insert_all"
    on public.app_state
    for insert
    with check (true);

drop policy if exists "app_state_update_all" on public.app_state;
create policy "app_state_update_all"
    on public.app_state
    for update
    using (true)
    with check (true);