File size: 958 Bytes
2a317a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
-- Create Analytics Storage Bucket
-- Run this in Supabase SQL Editor

-- 1. Create a public storage bucket for analytics data
INSERT INTO storage.buckets (id, name, public)
VALUES ('analytics-data', 'analytics-data', true)
ON CONFLICT (id) DO NOTHING;

-- 2. Allow public read access (for API to fetch data)
CREATE POLICY "Allow public read access on analytics-data"
ON storage.objects FOR SELECT
USING (bucket_id = 'analytics-data');

-- 3. Allow authenticated upsert (for API to write data)  
CREATE POLICY "Allow public insert on analytics-data"
ON storage.objects FOR INSERT
WITH CHECK (bucket_id = 'analytics-data');

CREATE POLICY "Allow public update on analytics-data"
ON storage.objects FOR UPDATE
USING (bucket_id = 'analytics-data');

CREATE POLICY "Allow public delete on analytics-data"
ON storage.objects FOR DELETE
USING (bucket_id = 'analytics-data');

-- Verify bucket was created
SELECT * FROM storage.buckets WHERE id = 'analytics-data';