added more support for supabase-js
This commit is contained in:
@@ -37,17 +37,19 @@ FOR EACH ROW EXECUTE FUNCTION madbase_realtime.broadcast_changes();
|
||||
|
||||
-- Storage Setup
|
||||
INSERT INTO storage.buckets (id, name, public) VALUES ('test-bucket', 'test-bucket', true) ON CONFLICT DO NOTHING;
|
||||
INSERT INTO storage.buckets (id, name, public) VALUES ('public-bucket', 'public-bucket', true) ON CONFLICT DO NOTHING;
|
||||
INSERT INTO storage.buckets (id, name, public) VALUES ('private-bucket', 'private-bucket', false) ON CONFLICT DO NOTHING;
|
||||
|
||||
-- Allow anon to upload to test-bucket
|
||||
-- Allow anon to upload to test-bucket and public-bucket
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT FROM pg_policies WHERE tablename = 'objects' AND policyname = 'Anon can insert into test-bucket'
|
||||
SELECT FROM pg_policies WHERE tablename = 'objects' AND policyname = 'Anon can insert into public buckets'
|
||||
) THEN
|
||||
CREATE POLICY "Anon can insert into test-bucket"
|
||||
CREATE POLICY "Anon can insert into public buckets"
|
||||
ON storage.objects FOR INSERT
|
||||
TO anon
|
||||
WITH CHECK ( bucket_id = 'test-bucket' );
|
||||
WITH CHECK ( bucket_id IN ('test-bucket', 'public-bucket') );
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
|
||||
Reference in New Issue
Block a user