Files
akmon/fix_downlink_policy.sql
2026-01-20 08:04:15 +08:00

20 lines
600 B
SQL

-- Fix for "new row violates row-level security policy for table chat_mqtt_downlinks"
-- Run this in Supabase SQL Editor
-- 1. Enable RLS (if not already)
ALTER TABLE chat_mqtt_downlinks ENABLE ROW LEVEL SECURITY;
-- 2. Allow authenticated users (logged in users) to INSERT
CREATE POLICY "Allow insert for authenticated users"
ON chat_mqtt_downlinks
FOR INSERT
TO authenticated
WITH CHECK (true);
-- 3. Allow authenticated users to SELECT (to see their own inserts or all)
CREATE POLICY "Allow select for authenticated users"
ON chat_mqtt_downlinks
FOR SELECT
TO authenticated
USING (true);