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,77 +0,0 @@
|
||||
-- 108_lot_quantity_tracking.sql
|
||||
-- Add quantity_used_lbs tracking to harvest_lots + wire get_lot_orders + mark_lot_used_in_order
|
||||
|
||||
ALTER TABLE harvest_lots ADD COLUMN IF NOT EXISTS quantity_used_lbs NUMERIC(12,2) DEFAULT 0 NOT NULL;
|
||||
|
||||
DROP FUNCTION IF EXISTS public.get_lot_orders(uuid);
|
||||
DROP FUNCTION IF EXISTS public.mark_lot_used_in_order(uuid, uuid, text, uuid);
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.get_lot_orders(p_lot_id uuid)
|
||||
RETURNS TABLE(
|
||||
id uuid,
|
||||
customer_name text,
|
||||
order_date text,
|
||||
stop_name text,
|
||||
item_quantity numeric,
|
||||
item_notes text,
|
||||
fulfillment text,
|
||||
lot_quantity_used numeric
|
||||
)
|
||||
LANGUAGE plpgsql
|
||||
SECURITY DEFINER
|
||||
AS $function$
|
||||
BEGIN
|
||||
RETURN QUERY
|
||||
SELECT
|
||||
o.id,
|
||||
COALESCE(c.name, c.email) as customer_name,
|
||||
TO_CHAR(o.created_at, 'MM/DD/YYYY') as order_date,
|
||||
s.name as stop_name,
|
||||
oi.quantity::NUMERIC as item_quantity,
|
||||
oi.notes as item_notes,
|
||||
oi.fulfillment,
|
||||
oi.quantity::NUMERIC as lot_quantity_used
|
||||
FROM order_items oi
|
||||
JOIN orders o ON o.id = oi.order_id
|
||||
LEFT JOIN customers c ON c.id = o.customer_id
|
||||
LEFT JOIN stops s ON s.id = o.stop_id
|
||||
WHERE oi.lot_id = p_lot_id
|
||||
OR oi.lot_number = (SELECT lot_number FROM harvest_lots WHERE id = p_lot_id);
|
||||
END;
|
||||
$function$;
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.mark_lot_used_in_order(
|
||||
p_lot_id uuid,
|
||||
p_order_id uuid,
|
||||
p_quantity_to_add numeric DEFAULT NULL,
|
||||
p_notes text DEFAULT NULL::text,
|
||||
p_admin_id uuid DEFAULT NULL::uuid
|
||||
)
|
||||
RETURNS boolean
|
||||
LANGUAGE plpgsql
|
||||
SECURITY DEFINER
|
||||
AS $function$
|
||||
DECLARE
|
||||
v_lot_number text;
|
||||
v_qty numeric;
|
||||
BEGIN
|
||||
SELECT lot_number INTO v_lot_number FROM harvest_lots WHERE id = p_lot_id;
|
||||
|
||||
IF p_quantity_to_add IS NOT NULL AND p_quantity_to_add > 0 THEN
|
||||
v_qty := p_quantity_to_add;
|
||||
ELSE
|
||||
SELECT COALESCE(SUM(oi.quantity), 0) INTO v_qty
|
||||
FROM order_items oi
|
||||
WHERE oi.lot_id = p_lot_id OR oi.lot_number = v_lot_number;
|
||||
END IF;
|
||||
|
||||
UPDATE harvest_lots
|
||||
SET quantity_used_lbs = COALESCE(quantity_used_lbs, 0) + v_qty
|
||||
WHERE id = p_lot_id;
|
||||
|
||||
INSERT INTO harvest_lot_events (lot_id, event_type, event_time, notes, created_by)
|
||||
VALUES (p_lot_id, 'marked_used', NOW(), p_notes, p_admin_id);
|
||||
|
||||
RETURN TRUE;
|
||||
END;
|
||||
$function$;
|
||||
Reference in New Issue
Block a user