ba94d755fa
- Update supabase/push-migrations.js: - Detect modern Supabase CLI link state (supabase/.temp/project-ref) - Prefer `supabase db query --linked --file` (works in this env where direct postgres connections fail with ENOTFOUND/network unreachable) - Updated docs/comments for `supabase login` + `supabase link --project-ref wnzkhezyhnfzhkhiflrp` workflow - Add MEMORY.md capturing the Supabase login/link session, tooling changes, migration patches applied, and gotchas - Patch migrations for current remote schema (column drift, syntax, idempotency, pre-existing tables): - 091_brand_plan_tier.sql: fix extra paren in get_brand_plan_info - 145_create_product_images_bucket.sql: allowed_mime_types + DROP POLICY IF EXISTS + safer bucket insert - 148_public_stops_rpc.sql: quote reserved "time" column in RETURNS TABLE + SELECT - 200_production_features.sql: add ALTER TABLE for user_activity_logs (originated in 036) so policies/indexes validate - 201_seed_data.sql: trim demo seeds with outdated column lists (products/stops/etc.); keep only compatible brands insert - Include 202_fix_admin_create_stop.sql and related stop creation updates (src/actions/stops/create-stop.ts, 147_admin_create_stop_rpcs.sql, ADMIN_CREATE_STOP_FIX.sql) - Update CLAUDE.md with pointer to MEMORY.md for recent migration work Applied via the new flow (after supabase login + link): 084, 091, 142–148, 200–202 etc. Refs: Supabase CLI now linked; use `node supabase/push-migrations.js <prefix>` or `npm run migrate:one NNN`
17 lines
815 B
SQL
17 lines
815 B
SQL
-- Create product-images bucket for product images (idempotent)
|
|
INSERT INTO storage.buckets (id, name, public, file_size_limit, allowed_mime_types)
|
|
SELECT 'product-images', 'product-images', true, 5242880, ARRAY['image/png', 'image/jpeg', 'image/webp']
|
|
WHERE NOT EXISTS (
|
|
SELECT 1 FROM storage.buckets WHERE id = 'product-images' OR name = 'product-images'
|
|
);
|
|
|
|
-- Enable public access to product-images bucket (re-runnable)
|
|
DROP POLICY IF EXISTS "Public can view product-images" ON storage.objects;
|
|
CREATE POLICY "Public can view product-images"
|
|
ON storage.objects FOR SELECT
|
|
USING (bucket_id = 'product-images');
|
|
|
|
DROP POLICY IF EXISTS "Admins can upload product-images" ON storage.objects;
|
|
CREATE POLICY "Admins can upload product-images"
|
|
ON storage.objects FOR INSERT
|
|
WITH CHECK (bucket_id = 'product-images'); |