Migrate Company Operations from Spreadsheets to Database

Problem

GTM Review Sheet and Brainforge Management Operations (Excel) contain critical company data (OKRs, AORs, sales metrics) that is:

  • Not traceable (no audit log)
  • Not queryable by agents/automation
  • Has coarse permissions
  • Requires manual copy-paste for WBR/MBR/QBR

Solution Architecture

Two-Track Approach

┌─────────────────────────────────────────────────────────────────────────┐
│                        DATA SOURCES                                      │
├─────────────────────────────────────────────────────────────────────────┤
│  GTM Review Sheet ──┐                                                    │
│  Management Ops ────┼──[MIGRATION]──┐                                  │
│  Partner Tracker ───┘                 │                                  │
│                                        ▼                                  │
│                              ┌─────────────────┐                         │
│                              │   Supabase DB   │                         │
│                              │  (internal)     │                         │
│                              │                 │                         │
│  ┌─────────────────┐         │ • company_okrs  │                         │
│  │   Snowflake     │         │ • company_aors  │         ┌─────────────┐│
│  │                 │◄────────│ • sales_wbr     │────────►│    Rill     ││
│  │ • QuickBooks    │         │ • partners      │         │ Dashboards  ││
│  │ • Clockify      │         │ • software      │         │ (read-only) ││
│  │ • Allocations   │         └─────────────────┘         └─────────────┘│
│  └─────────────────┘                    │                                  │
│                                        ▼                                  │
│                              ┌─────────────────┐                         │
│                              │  Platform UI    │                         │
│                              │  (/internal/*)  │                         │
│                              │                 │                         │
│                              │ • company-goals │  ← OKRs, AORs           │
│                              │ • sales-wbr     │  ← Weekly Business Rev  │
│                              │ • software      │  ← Tool inventory       │
│                              │ • partners      │  ← Partner tracker      │
│                              └─────────────────┘                         │
│                                        │                                  │
│                                        ▼                                  │
│                              ┌─────────────────┐                         │
│                              │   Integrations  │                         │
│                              │                 │                         │
│                              │ • Linear API    │  ← OKR → Initiative    │
│                              │ • HubSpot API   │  ← Partner → Deal       │
│                              │ • Notion API    │  ← AOR → SOP            │
│                              └─────────────────┘                         │
└─────────────────────────────────────────────────────────────────────────┘

Track 1: Finance/Delivery (Already In Progress)

  • Status: Active project via Rill on Snowflake
  • Scope: P&L, revenue, costs, margins, utilization, allocation vs actual
  • Action: Continue; don’t derail

Track 2: Operational Data (This Plan)

  • Scope: OKRs, AORs, sales WBR/MBR, software review, partner tracker
  • Destination: Supabase + Platform UI
  • Migration: One-time import from Sheets, then retire Sheets

Implementation Phases

Phase 1: Foundation (Week 1-2)

Goal: Database schema, migration scripts, API layer

1.1 Database Schema (Supabase internal)

Table: company_objectives

- id (uuid, pk)
- objective (text)
- why (text)
- exec_focus (text)
- period (text) -- 'Q1 2026', 'Q2 2026', 'FY2026'
- status (enum: 'on_track', 'at_risk', 'completed', 'not_started')
- created_at, updated_at
- created_by, updated_by (for audit)

Table: company_okrs

- id (uuid, pk)
- period (text) -- 'Q1 2026', 'Q2 2026'
- okr_type (enum: 'bau', 'aspirational')
- department (text) -- 'Sales', 'Marketing', 'Delivery'
- objective (text)
- key_results (jsonb array)
- owner (uuid -> team table)
- workspace_link (text)
- commentary (text)
- status (enum: 'on_track', 'lagging', 'poor', 'kickoff', 'completed')
- value (text) -- current metric value
- key_update (text)
- next_step (text)
- linear_initiative_id (text) -- link to Linear
- created_at, updated_at, created_by, updated_by

Table: company_aors

- id (uuid, pk)
- department (text)
- aor_description (text)
- importance (enum: 'critical', 'high', 'medium')
- dri (uuid -> team table)
- backup (uuid -> team table)
- dri_status (enum: 'active', 'vacant', 'at_risk')
- period (text) -- 'Q1 2026'
- created_at, updated_at

Table: sales_wbr (Weekly Business Review)

- id (uuid, pk)
- week_ending (date)
- metric_name (text)
- metric_value (numeric)
- target (numeric)
- vs_target_pct (numeric)
- vs_prior_week_pct (numeric)
- commentary (text)
- owner (uuid -> team table)
- created_at, updated_by

Table: software_inventory

- id (uuid, pk)
- tool_name (text)
- owner_department (text)
- sme (uuid -> team table)
- purpose (text)
- expense_type (enum: 'fixed', 'variable')
- billing_cycle (enum: 'monthly', 'quarterly', 'annually')
- renewal_date (date)
- seats_purchased (int)
- seats_active (int)
- cost_per_seat (numeric)
- monthly_cost (numeric)
- annual_cost (numeric)
- seat_optimization_score (int)
- status (enum: 'active', 'inactive', 'evaluating')
- action (text)
- pl_category (text) -- P&L category
- notes (text)
- created_at, updated_at

Table: partners

- id (uuid, pk)
- partner_name (text)
- partner_type (text)
- archetype (text)
- hyperscaler (text)
- slack_channel (text)
- origin_story (text)
- last_action_date (date)
- last_action_notes (text)
- next_action_date (date)
- next_action_notes (text)
- blockers (text)
- icp_match (boolean)
- accounts_named (text)
- intro_mechanism (text)
- economics (text)
- goal_90d (text)
- start_90d (date)
- status_90d (enum: 'on_track', 'at_risk', 'delivered', 'failed')
- key_contact_name (text)
- key_contact_role (text)
- relationship_notes (text)
- reps_bringing_deals (int)
- reps_engaged (int)
- leads_generated (int)
- closed_won_deals (int)
- days_since_last_touch (int)
- hubspot_link (text)
- created_at, updated_at

1.2 Migration Scripts

  • scripts/migrate_okrs.ts - Import from GTM Review Sheet + Management Ops
  • scripts/migrate_aors.ts - Import from Management Ops “Q126 AOR” sheet
  • scripts/migrate_software.ts - Import from software-review-2026-02-28.csv
  • scripts/migrate_partners.ts - Import from Partner Tracker (51 columns)

Data validation:

  • Row count matches source
  • Required fields populated
  • FK references (owner, dri) resolve to team table

1.3 API Layer

New API routes following existing platform pattern:

  • GET /api/brainforge/company-goals - OKRs + objectives
  • GET /api/brainforge/company-aors - AORs
  • GET/POST/PATCH/DELETE /api/brainforge/sales-wbr - WBR CRUD
  • GET/POST/PATCH/DELETE /api/brainforge/software - Software inventory
  • GET/POST/PATCH/DELETE /api/brainforge/partners - Partner tracker

Phase 2: Platform UI (Week 2-3)

Goal: CRUD interfaces for each data type

2.1 Company Goals Page (/internal/company-goals)

Layout:

┌─────────────────────────────────────────────┐
│  Company Goals              [+ Add OKR]     │
├─────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐          │
│  │ Q1 2026 OKRs │  │ Q2 2026 OKRs │          │
│  │ (accordion)  │  │ (accordion)  │          │
│  └─────────────┘  └─────────────┘          │
├─────────────────────────────────────────────┤
│  Areas of Responsibility (AORs)             │
│  [Department] [DRI] [Backup] [Status]      │
├─────────────────────────────────────────────┤
│  Company Objectives                         │
│  • Objective 1 - Why - Exec Focus          │
└─────────────────────────────────────────────┘

Components:

  • OkrCard - Expandable OKR with key results, status, owner
  • AorTable - Sortable/filterable table of AORs
  • ObjectiveBanner - Top-level company objectives
  • AddOkrModal - Form for new OKR
  • EditOkrModal - Form for editing with audit trail

Features:

  • Filter by period, department, status
  • Link to Linear initiative (if integrated)
  • Status history (when status changed, by whom)
  • Export to CSV/Print for board meetings

2.2 Sales WBR Page (/internal/sales-wbr)

Layout:

┌─────────────────────────────────────────────┐
│  Weekly Business Review    [Week: Mar 24]  │
├─────────────────────────────────────────────┤
│  KPIs (header cards)                        │
│  • Pipeline: $X | Target: $Y | +12% WoW    │
│  • New Deals: X | Target: Y | -5% WoW      │
│  • Avg Deal Size: $X | +8% WoW             │
├─────────────────────────────────────────────┤
│  Commentary                                 │
│  [Rich text area for narrative]             │
├─────────────────────────────────────────────┤
│  Historical (table)                         │
│  Week | Pipeline | Deals | Close Rate      │
└─────────────────────────────────────────────┘

Integration: Data from Snowflake (HubSpot deals) populated automatically, commentary added manually.

2.3 Software Review Page (/internal/software)

Layout:

┌─────────────────────────────────────────────┐
│  Software Inventory     [+ Add Tool]       │
│  Total Monthly: $6,664 | Annual: $77,311   │
├─────────────────────────────────────────────┤
│  Filters: [Status ▼] [Dept ▼] [Renewal ▼] │
├─────────────────────────────────────────────┤
│  ┌─────────────────────────────────────┐   │
│  │ Tool | Owner | Seats | Cost/Mo |   │   │
│  │      | Renewal | Status | Action  │   │
│  └─────────────────────────────────────┘   │
├─────────────────────────────────────────────┤
│  Alerts                                     │
│  ⚠️ 3 renewals in next 30 days             │
│  ⚠️ 5 tools with <50% seat utilization     │
└─────────────────────────────────────────────┘

Features:

  • Renewal date alerts (30, 60, 90 days)
  • Seat optimization score visualization
  • P&L category rollups
  • Action tracking (cancel, downgrade, annualize)

2.4 Partner Tracker Page (/internal/partners)

Layout:

┌─────────────────────────────────────────────┐
│  Partners               [+ Add Partner]    │
├─────────────────────────────────────────────┤
│  Views: [All] [90D Test] [Needs Action]     │
├─────────────────────────────────────────────┤
│  ┌─────────────────────────────────────┐   │
│  │ Partner | 90D Status | Next Action  │   │
│  │ Reps Deals | Leads | Blockers       │   │
│  └─────────────────────────────────────┘   │
├─────────────────────────────────────────────┤
│  Daily Action Queue                         │
│  (Partners with next_action_date < today)  │
└─────────────────────────────────────────────┘

Features:

  • Filter views: All, 90D On Track/At Risk, Needs Attention
  • Daily action queue (from NEXT_ACTION_DATE)
  • Quick update: 90D status, rep counts, action notes
  • Link to HubSpot for rep-level detail

Phase 3: Integrations (Week 4-5)

Goal: Connect to existing systems

3.1 Linear Integration

  • OKR → Initiative: Link OKRs to Linear initiatives/projects
  • AOR → Team: Link DRI/backup to actual Linear team members
  • Auto-populate: Pull initiative status into OKR status

3.2 HubSpot Integration

  • Partner → Deal: Show partner-sourced deals in partner record
  • Sales WBR: Populate pipeline/deals metrics from HubSpot
  • Rep tracking: Keep rep-level detail in HubSpot, roll up to partner record

3.3 Snowflake Integration

  • Sales WBR: Pull actual metrics (deals, pipeline) from Snowflake
  • Software costs: Compare actual spend (QuickBooks) vs planned
  • Read-only view: Embedded Rill dashboards for deep analytics

3.4 Notion Integration

  • AOR → SOP: Link AORs to Notion SOPs
  • Backup sync: Keep Notion as fallback, but platform is primary

Phase 4: WBR/MBR Automation (Week 5-6)

Goal: Generate business reviews from live data

4.1 WBR Generation

  • Pull metrics from Snowflake (actual)
  • Pull commentary from platform (narrative)
  • Generate structured WBR document
  • Export to Google Slides template

4.2 MBR/QBR Generation

  • Roll up weekly data
  • Compare to OKR progress
  • Flag risks (overdue OKRs, at-risk AORs)
  • Generate exec summary

File Structure

apps/platform/
├── src/
│   ├── app/
│   │   ├── api/
│   │   │   └── brainforge/
│   │   │       ├── company-goals/
│   │   │       │   └── route.ts
│   │   │       ├── company-aors/
│   │   │       │   └── route.ts
│   │   │       ├── sales-wbr/
│   │   │       │   └── route.ts
│   │   │       ├── software/
│   │   │       │   └── route.ts
│   │   │       └── partners/
│   │   │           └── route.ts
│   │   └── (main)/
│   │       └── internal/
│   │           ├── company-goals/
│   │           │   └── page.tsx
│   │           ├── sales-wbr/
│   │           │   └── page.tsx
│   │           ├── software/
│   │           │   └── page.tsx
│   │           └── partners/
│   │               └── page.tsx
│   ├── components/
│   │   └── internal/
│   │       ├── okrs/
│   │       │   ├── OkrCard.tsx
│   │       │   ├── OkrTable.tsx
│   │       │   ├── AddOkrModal.tsx
│   │       │   └── EditOkrModal.tsx
│   │       ├── aors/
│   │       │   ├── AorTable.tsx
│   │       │   └── AorCard.tsx
│   │       ├── sales/
│   │       │   ├── WbrDashboard.tsx
│   │       │   └── MetricCard.tsx
│   │       ├── software/
│   │       │   ├── SoftwareTable.tsx
│   │       │   └── RenewalAlert.tsx
│   │       └── partners/
│   │           ├── PartnerTable.tsx
│   │           ├── PartnerCard.tsx
│   │           └── ActionQueue.tsx
│   └── types/
│       └── internal.ts          # Shared types for OKRs, AORs, etc.
├── supabase/
│   └── migrations/
│       ├── 010_company_okrs.sql
│       ├── 011_company_aors.sql
│       ├── 012_sales_wbr.sql
│       ├── 013_software_inventory.sql
│       └── 014_partners.sql
└── scripts/
    └── migrate/
        ├── migrate_okrs.ts
        ├── migrate_aors.ts
        ├── migrate_software.ts
        └── migrate_partners.ts

Success Criteria

  1. Migration complete: All data from GTM Review, Management Ops, Software CSV, Partner Tracker imported
  2. UI functional: All CRUD operations work for OKRs, AORs, Software, Partners
  3. Integrations live: Linear links work, HubSpot sync works, Snowflake read works
  4. Sheets retired: Source spreadsheets archived (kept for reference but no longer updated)
  5. WBR automated: Weekly business review generated from live data + platform commentary
  6. Audit trail: All changes logged (who, what, when)
  7. Permissions correct: Row-level security appropriate for each data type

Open Questions

  1. OKR editing permissions: Can anyone edit any OKR, or only owners/department heads?
  2. WBR frequency: Weekly data entry - who’s responsible for updating?
  3. Partner tracker sync: Keep HubSpot as source of truth for rep-level, or pull into platform?
  4. Software review ownership: Who maintains this ongoing - Finance, Ops, or individual owners?
  5. Historical data: How many quarters of OKR history to migrate vs archive?