From f7706e0abb8d521aaab8c73318f5d0b79841b9e8 Mon Sep 17 00:00:00 2001 From: hailin Date: Thu, 26 Jun 2025 23:07:13 +0800 Subject: [PATCH] . --- .../migrations/20240108234541_add_profiles.sql | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/chatdesk-ui/supabase/migrations/20240108234541_add_profiles.sql b/chatdesk-ui/supabase/migrations/20240108234541_add_profiles.sql index ea2b5b6..1058fde 100644 --- a/chatdesk-ui/supabase/migrations/20240108234541_add_profiles.sql +++ b/chatdesk-ui/supabase/migrations/20240108234541_add_profiles.sql @@ -39,7 +39,14 @@ CREATE TABLE IF NOT EXISTS profiles ( -- INDEXES -- -CREATE INDEX idx_profiles_user_id ON profiles (user_id); +DO $$ +BEGIN + IF NOT EXISTS ( + SELECT 1 FROM pg_indexes WHERE indexname = 'idx_profiles_user_id' + ) THEN + CREATE INDEX idx_profiles_user_id ON profiles (user_id); + END IF; +END $$; -- RLS -- @@ -152,7 +159,7 @@ EXECUTE PROCEDURE delete_old_profile_image(); -- STORAGE -- -INSERT INTO storage.buckets (id, name, public) VALUES ('profile_images', 'profile_images', true); +INSERT INTO storage.buckets (id, name, public) VALUES ('profile_images', 'profile_images', true) ON CONFLICT (id) DO NOTHING; CREATE POLICY "Allow public read access on profile images" ON storage.objects FOR SELECT