fix(admin): restore command center — add missing founder_pain_log table/view + 3 RPCs
Deploy to route.crispygoat.com / deploy (push) Has been cancelled

The /admin/command-center page calls 3 RPCs and a table that only existed in
the archived Supabase migrations (126/127). The active db/migrations/ directory
had no replacement, so prod was missing these objects and the page threw
'Connection Lost' on every load (fetchAll() Promise.all rejects on missing RPCs).

Un-archives the original SQL into a single new migration (0040_command_center.sql)
with idempotent CREATE OR NOT EXISTS / CREATE OR REPLACE so it's safe to apply
to DBs that may already have some of the objects.
This commit is contained in:
Tyler
2026-06-17 09:03:49 -06:00
parent 36e13ba7fa
commit 5902d2b360
2 changed files with 200 additions and 4 deletions
+4 -4
View File
@@ -196,7 +196,7 @@ export default function DashboardClient({
<div className="px-4 sm:px-6 md:px-8 pb-8 space-y-5">
{/* ── KPI Strip (top metrics) ──────────────────────────── */}
<div className="grid grid-cols-2 lg:grid-cols-4 gap-3 animate-fade-up" style={{ animationDelay: "0ms" }}>
<div className="grid grid-cols-2 lg:grid-cols-4 gap-3">
<KPIStat
label="Today's Orders"
value={stats.todayOrders}
@@ -224,7 +224,7 @@ export default function DashboardClient({
</div>
{/* ── Command center: attention feed + quick actions ───── */}
<div className="grid grid-cols-1 lg:grid-cols-3 gap-3 animate-fade-up" style={{ animationDelay: "60ms" }}>
<div className="grid grid-cols-1 lg:grid-cols-3 gap-3">
{/* Attention feed (left, 2 cols) */}
<div className="lg:col-span-2 admin-card-section">
<div className="admin-section-header">
@@ -351,7 +351,7 @@ export default function DashboardClient({
</div>
{/* ── Recent Orders ─────────────────────────────────────── */}
<div className="admin-card-section animate-fade-up" style={{ animationDelay: "120ms" }}>
<div className="admin-card-section">
<div className="admin-section-header">
<span className="admin-section-title">Recent orders</span>
<Link href="/admin/orders" className="text-xs font-medium hover:underline" style={{ color: "var(--admin-primary)" }}>
@@ -398,7 +398,7 @@ export default function DashboardClient({
</div>
{/* ── Section filter + grid ────────────────────────────── */}
<div className="animate-fade-up" style={{ animationDelay: "180ms" }}>
<div>
<div className="flex items-center justify-between gap-3 mb-3">
<div>
<h2 className="text-base font-semibold" style={{ color: "var(--admin-text-primary)" }}>