-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDISABLE_RLS.sql
More file actions
27 lines (24 loc) · 1.12 KB
/
DISABLE_RLS.sql
File metadata and controls
27 lines (24 loc) · 1.12 KB
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
-- Disable Row-Level Security (RLS) for Load Monitor Tables
--
-- Run this in your Supabase SQL Editor to allow the monitor to write data
-- to the database using the anon key.
--
-- Why is this needed?
-- By default, Supabase enables RLS on all tables, which blocks all INSERT/UPDATE
-- operations unless you create specific policies. For a server-side monitoring app,
-- the simplest approach is to disable RLS.
--
-- Security Note:
-- This is safe for server-side monitoring apps, but anyone with your anon key
-- could theoretically write to these tables. For production, consider using the
-- service role key instead (and keep it secret).
ALTER TABLE monitoring_runs DISABLE ROW LEVEL SECURITY;
ALTER TABLE block_number_checks DISABLE ROW LEVEL SECURITY;
ALTER TABLE market_data_checks DISABLE ROW LEVEL SECURITY;
ALTER TABLE data_inconsistencies DISABLE ROW LEVEL SECURITY;
-- Verify RLS is disabled
SELECT tablename, rowsecurity
FROM pg_tables
WHERE schemaname = 'public'
AND tablename IN ('monitoring_runs', 'block_number_checks', 'market_data_checks', 'data_inconsistencies');
-- You should see rowsecurity = false for all tables