consumer模块完成95%,在和商家端对接聊天购物闭环

This commit is contained in:
2026-02-06 17:10:31 +08:00
parent 06b7369494
commit e2f1dfb097
1454 changed files with 5425 additions and 210555 deletions

View File

@@ -0,0 +1,29 @@
-- create_shop_follows.sql
-- Run this in Supabase SQL Editor
CREATE TABLE IF NOT EXISTS public.ml_shop_follows (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
shop_id UUID NOT NULL REFERENCES public.ml_shops(id) ON DELETE CASCADE, -- Assuming ml_shops.id is UUID
created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL,
UNIQUE(user_id, shop_id)
);
-- Enable RLS
ALTER TABLE public.ml_shop_follows ENABLE ROW LEVEL SECURITY;
-- Policies
CREATE POLICY "Users can view their own follows"
ON public.ml_shop_follows FOR SELECT
USING (auth.uid() = user_id);
CREATE POLICY "Users can create their own follows"
ON public.ml_shop_follows FOR INSERT
WITH CHECK (auth.uid() = user_id);
CREATE POLICY "Users can delete their own follows"
ON public.ml_shop_follows FOR DELETE
USING (auth.uid() = user_id);
-- Optional: View count on shops
-- You might want to add follower_count to ml_shops and use triggers to update it.