This commit is contained in:
hailin 2025-06-26 23:07:13 +08:00
parent bffbc4665a
commit f7706e0abb
1 changed files with 9 additions and 2 deletions

View File

@ -39,7 +39,14 @@ CREATE TABLE IF NOT EXISTS profiles (
-- INDEXES -- -- 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 -- -- RLS --
@ -152,7 +159,7 @@ EXECUTE PROCEDURE delete_old_profile_image();
-- STORAGE -- -- 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" CREATE POLICY "Allow public read access on profile images"
ON storage.objects FOR SELECT ON storage.objects FOR SELECT