chore(supabase): full purge — remove all Supabase references from codebase
- Delete supabase/ directory (config.toml, push-migrations.js, ADMIN_CREATE_STOP_FIX.sql, 137 archived migration files) - Remove @supabase/ssr and @supabase/supabase-js from package.json - Strip *.supabase.co from next.config.ts image hostnames - Strip https://*.supabase.co from vercel.json CSP connect-src - Remove 'supabase/**' ignore from eslint.config.mjs - Clean supabase references from src/lib/db.ts, vitest.config.ts, db/seeds/2026-tuxedo-tour-stops.sql, src/actions/storefront.ts, scripts/import-tuxedo-stops.ts comments - Rewrite env-var docs in README, ENVIRONMENT, PRODUCTION_SETUP, PRODUCTION_DEPLOYMENT_CHECKLIST, LAUNCH_CHECKLIST, CLAUDE, MEMORY, REPORT to drop NEXT_PUBLIC_SUPABASE_URL / SUPABASE_SERVICE_ROLE_KEY / supabase link / supabase CLI references The canonical migration runner is now scripts/migrate.js (uses pg directly via DATABASE_URL). Migrations live in db/migrations/. The Supabase CLI is no longer in the codebase. The only remaining '@supabase/*' in the dep tree is @supabase/auth-js as a transitive of @neondatabase/auth (Neon Auth / Better Auth). Final source scan: grep -rln '@supabase\|rest/v1\|supabase\.co' src/ tests/ db/ scripts/ next.config.ts vercel.json eslint.config.mjs package.json returns zero. Verification: npm install clean (11 added, 21 removed, 12 changed), tsc shows same 17 pre-existing errors (Stripe dahlia API version + fetch preconnect mocks), vitest 172/175 (3 pre-existing failures in getAdminUser.test.ts), lint shows same 14 pre-existing errors. Live-tested: dev server boots in 248ms, public storefronts (/) (/login) (/pricing) (/tuxedo) (/indian-river-direct) all return 200; /admin/v2?demo=1 reaches 200 after dev_session redirect; storefront renders real brand content.
This commit is contained in:
@@ -1,86 +0,0 @@
|
||||
-- Migration 040: Shipping Fulfillment RPCs
|
||||
-- Idempotent: CREATE OR REPLACE FUNCTION
|
||||
|
||||
-- ── 1. update_shipping_order ──────────────────────────────────────────────────
|
||||
-- Updates shipping_status and tracking_number for an order.
|
||||
-- Requires can_manage_orders permission (checked in server action via getAdminUser).
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.update_shipping_order(
|
||||
p_order_id UUID,
|
||||
p_shipping_status TEXT,
|
||||
p_tracking_number TEXT DEFAULT NULL
|
||||
)
|
||||
RETURNS JSONB
|
||||
LANGUAGE plpgsql SECURITY DEFINER SET search_path = public
|
||||
AS $$
|
||||
BEGIN
|
||||
UPDATE orders SET
|
||||
shipping_status = p_shipping_status,
|
||||
tracking_number = p_tracking_number,
|
||||
updated_at = now()
|
||||
WHERE id = p_order_id;
|
||||
|
||||
IF NOT FOUND THEN
|
||||
RETURN jsonb_build_object('success', false, 'error', 'Order not found');
|
||||
END IF;
|
||||
|
||||
RETURN jsonb_build_object('success', true);
|
||||
END;
|
||||
$$;
|
||||
|
||||
-- ── 2. get_shipping_orders ───────────────────────────────────────────────────
|
||||
-- Returns orders that contain at least one shipping-line item.
|
||||
-- Filtered by brand_id when p_brand_id is provided.
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.get_shipping_orders(p_brand_id UUID DEFAULT NULL)
|
||||
RETURNS JSONB
|
||||
LANGUAGE plpgsql SECURITY DEFINER SET search_path = public
|
||||
AS $$
|
||||
DECLARE
|
||||
v_result JSONB;
|
||||
BEGIN
|
||||
SELECT jsonb_agg(
|
||||
jsonb_build_object(
|
||||
'id', o.id,
|
||||
'customer_name', o.customer_name,
|
||||
'customer_email', o.customer_email,
|
||||
'customer_phone', o.customer_phone,
|
||||
'status', o.status,
|
||||
'subtotal', o.subtotal,
|
||||
'shipping_status', o.shipping_status,
|
||||
'tracking_number', o.tracking_number,
|
||||
'created_at', o.created_at,
|
||||
'brand_id', o.brand_id,
|
||||
'order_items', COALESCE((
|
||||
SELECT jsonb_agg(jsonb_build_object(
|
||||
'id', oi.id,
|
||||
'product_id', oi.product_id,
|
||||
'quantity', oi.quantity,
|
||||
'price', oi.price,
|
||||
'fulfillment', oi.fulfillment,
|
||||
'products', jsonb_build_object('name', p.name)
|
||||
))
|
||||
FROM order_items oi
|
||||
JOIN products p ON oi.product_id = p.id
|
||||
WHERE oi.order_id = o.id AND oi.fulfillment = 'shipping'
|
||||
), '[]'::JSONB)
|
||||
)
|
||||
)
|
||||
INTO v_result
|
||||
FROM orders o
|
||||
WHERE o.id IN (
|
||||
SELECT DISTINCT oi.order_id
|
||||
FROM order_items oi
|
||||
WHERE oi.fulfillment = 'shipping'
|
||||
)
|
||||
AND (
|
||||
p_brand_id IS NULL
|
||||
OR o.brand_id = p_brand_id
|
||||
)
|
||||
ORDER BY o.created_at DESC;
|
||||
|
||||
RETURN COALESCE(v_result, '[]'::JSONB);
|
||||
END;
|
||||
$$;
|
||||
|
||||
NOTIFY pgrst, 'reload schema';
|
||||
Reference in New Issue
Block a user