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,103 +0,0 @@
|
||||
-- =============================================================================
|
||||
-- Water Log V1.6 - Display Summary RPC
|
||||
-- Returns headgate latest readings + today's aggregates for Smartsheet/display.
|
||||
-- SECURITY DEFINER so anon key can call it (same as other water log RPCs).
|
||||
-- =============================================================================
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.get_water_display_summary(p_brand_id uuid)
|
||||
RETURNS jsonb
|
||||
LANGUAGE plpgsql
|
||||
SECURITY DEFINER SET search_path = public
|
||||
AS $$
|
||||
BEGIN
|
||||
RETURN (
|
||||
WITH headgate_data AS (
|
||||
SELECT
|
||||
hg.id,
|
||||
hg.name,
|
||||
COALESCE(hg.unit, 'CFS') as unit,
|
||||
(
|
||||
SELECT jsonb_build_object(
|
||||
'measurement', le.measurement,
|
||||
'user_name', u.name,
|
||||
'logged_at', le.logged_at
|
||||
)
|
||||
FROM public.water_log_entries le
|
||||
JOIN public.water_users u ON u.id = le.user_id
|
||||
WHERE le.headgate_id = hg.id
|
||||
ORDER BY le.logged_at DESC
|
||||
LIMIT 1
|
||||
) as latest_entry,
|
||||
(
|
||||
SELECT le.logged_at
|
||||
FROM public.water_log_entries le
|
||||
WHERE le.headgate_id = hg.id
|
||||
ORDER BY le.logged_at DESC
|
||||
LIMIT 1
|
||||
) as last_logged_at,
|
||||
(
|
||||
SELECT FLOOR(EXTRACT(EPOCH FROM (now() - le.logged_at)) / 60)::int
|
||||
FROM public.water_log_entries le
|
||||
WHERE le.headgate_id = hg.id
|
||||
ORDER BY le.logged_at DESC
|
||||
LIMIT 1
|
||||
) as minutes_ago
|
||||
FROM public.water_headgates hg
|
||||
WHERE hg.brand_id = p_brand_id
|
||||
AND hg.active = true
|
||||
AND hg.deleted_at IS NULL
|
||||
),
|
||||
today_stats AS (
|
||||
SELECT
|
||||
count(*) as cnt,
|
||||
COALESCE(sum(measurement), 0) as total
|
||||
FROM public.water_log_entries
|
||||
WHERE brand_id = p_brand_id AND logged_at::date = CURRENT_DATE
|
||||
),
|
||||
entries_ordered AS (
|
||||
SELECT e.logged_at, e.headgate_id, e.user_id, e.measurement, e.unit, e.notes, e.submitted_via
|
||||
FROM public.water_log_entries e
|
||||
WHERE e.brand_id = p_brand_id
|
||||
ORDER BY e.logged_at DESC
|
||||
LIMIT 20
|
||||
),
|
||||
recent_entries_agg AS (
|
||||
SELECT COALESCE(jsonb_agg(
|
||||
jsonb_build_object(
|
||||
'logged_at', e.logged_at,
|
||||
'headgate_name', hg.name,
|
||||
'user_name', u.name,
|
||||
'user_role', u.role,
|
||||
'measurement', e.measurement,
|
||||
'unit', e.unit,
|
||||
'notes', e.notes,
|
||||
'submitted_via', e.submitted_via
|
||||
)
|
||||
), '[]'::jsonb) as data
|
||||
FROM entries_ordered e
|
||||
JOIN public.water_headgates hg ON hg.id = e.headgate_id
|
||||
JOIN public.water_users u ON u.id = e.user_id
|
||||
)
|
||||
SELECT jsonb_build_object(
|
||||
'headgates', (
|
||||
SELECT COALESCE(jsonb_agg(
|
||||
jsonb_build_object(
|
||||
'id', hd.id,
|
||||
'name', hd.name,
|
||||
'unit', hd.unit,
|
||||
'latest_entry', hd.latest_entry,
|
||||
'last_logged_at', hd.last_logged_at,
|
||||
'minutes_ago', hd.minutes_ago
|
||||
)
|
||||
), '[]'::jsonb)
|
||||
FROM headgate_data hd
|
||||
),
|
||||
'today_count', (SELECT cnt FROM today_stats),
|
||||
'today_total', (SELECT total FROM today_stats),
|
||||
'recent_entries', (SELECT data FROM recent_entries_agg)
|
||||
)
|
||||
);
|
||||
END;
|
||||
$$;
|
||||
|
||||
NOTIFY pgrst, 'reload schema';
|
||||
Reference in New Issue
Block a user