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,73 +0,0 @@
|
||||
-- Migration 084: FedEx Shipments Table
|
||||
-- Stores created FedEx shipment records with label URL, tracking, and special services.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.shipments (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
order_id UUID NOT NULL REFERENCES orders ON DELETE CASCADE,
|
||||
|
||||
-- Carrier details
|
||||
carrier TEXT NOT NULL DEFAULT 'fedex',
|
||||
service_type TEXT NOT NULL, -- FEDEX_OVERNIGHT, FEDEX_2_DAY_AIR, FEDEX_GROUND, etc.
|
||||
tracking_number TEXT,
|
||||
label_url TEXT, -- FedEx label PDF URL
|
||||
rate_charged NUMERIC(10, 2), -- Actual rate charged by FedEx (cents)
|
||||
|
||||
-- Delivery estimates
|
||||
estimated_delivery_date DATE,
|
||||
|
||||
-- Special handling applied
|
||||
is_refrigerated BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
is_fragile BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
handling_notes TEXT, -- Custom per-shipment notes
|
||||
|
||||
-- Status
|
||||
status TEXT NOT NULL DEFAULT 'created', -- created | label_voided | cancelled
|
||||
fedex_shipment_id TEXT, -- FedEx internal shipment ID (for voiding)
|
||||
|
||||
-- Audit
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
created_by UUID REFERENCES admin_users(user_id)
|
||||
);
|
||||
|
||||
ALTER TABLE public.shipments ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
-- Shipments visible to brand admins and platform admins for the order's brand
|
||||
CREATE POLICY brand_admin_view_shipments ON public.shipments
|
||||
FOR SELECT
|
||||
USING (
|
||||
EXISTS (
|
||||
SELECT 1 FROM orders o
|
||||
WHERE o.id = shipments.order_id
|
||||
AND o.brand_id = (
|
||||
SELECT brand_id FROM admin_users WHERE user_id = auth.uid() LIMIT 1
|
||||
)
|
||||
)
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM admin_users au
|
||||
WHERE au.user_id = auth.uid()
|
||||
AND au.role = 'platform_admin'
|
||||
)
|
||||
);
|
||||
|
||||
CREATE POLICY brand_admin_manage_shipments ON public.shipments
|
||||
FOR ALL
|
||||
USING (
|
||||
EXISTS (
|
||||
SELECT 1 FROM orders o
|
||||
WHERE o.id = shipments.order_id
|
||||
AND o.brand_id = (
|
||||
SELECT brand_id FROM admin_users WHERE user_id = auth.uid() LIMIT 1
|
||||
)
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM admin_users au
|
||||
WHERE au.user_id = auth.uid()
|
||||
AND au.brand_id = o.brand_id
|
||||
AND au.role IN ('brand_admin', 'platform_admin')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS shipments_order_idx ON public.shipments (order_id);
|
||||
CREATE INDEX IF NOT EXISTS shipments_tracking_idx ON public.shipments (tracking_number);
|
||||
CREATE INDEX IF NOT EXISTS shipments_status_idx ON public.shipments (status);
|
||||
Reference in New Issue
Block a user