Documentation

VIEWING_DATABASE_IN_SUPABASE

docs/VIEWING_DATABASE_IN_SUPABASE.md

Viewing Database Data in Supabase

Quick Access

  1. Go to Supabase Dashboard: https://supabase.com/dashboard
  2. Select your project: petunia (jwgdiwhuulaxzfajogfb)
  3. Click "Table Editor" in left sidebar (database icon)

Viewing Different Tables

View Users (you already know this)

  • Click "Authentication" → "Users" in sidebar
  • Shows email, created date, last sign in
  • BUT: Does NOT show onboarding status, role, etc.

View Full User Data (with onboarding, role, etc.)

  1. Click "Table Editor"
  2. Select "User" table from dropdown
  3. You'll see ALL fields: email, name, role, onboardingCompleted, etc.

View Portals (where PIDs live)

  1. Click "Table Editor"
  2. Select "Portal" table from dropdown
  3. Columns you'll see:
    • id - Internal UUID
    • petuniaID - This is the PID! (e.g., PID-DEMO-001)
    • name - Portal name (e.g., "Demo Company")
    • isDemoPortal - Boolean flag
    • status - active/inactive
    • createdAt, updatedAt

View User-Portal Access (who has access to which portals)

  1. Click "Table Editor"
  2. Select "UserPortalAccess" table
  3. Shows: userId, portalId, role (owner/admin/user)

View Admins (platform admin vs demo admin)

  1. Click "Table Editor"
  2. Select "Admin" table
  3. Shows: userId, isPlatformAdmin, isDemoAdmin

Running SQL Queries (Advanced)

  1. Click "SQL Editor" in left sidebar
  2. Click "+ New query"
  3. Example queries:
-- View all portals with their PIDs
SELECT "petuniaID", name, "isDemoPortal", status 
FROM "Portal";

-- View all users with their portals
SELECT 
  u.email,
  u.role,
  u."onboardingCompleted",
  p."petuniaID",
  p.name as portal_name,
  upa.role as portal_role
FROM "User" u
LEFT JOIN "UserPortalAccess" upa ON u.id = upa."userId"
LEFT JOIN "Portal" p ON upa."portalId" = p.id;

-- View demo portal details
SELECT * FROM "Portal" WHERE "petuniaID" = 'PID-DEMO-001';

Quick Reference: Table Names

What You Want to SeeTable NameKey Fields
Users (basic)Authentication → Usersemail, created_at
Users (full details)Useremail, role, onboardingCompleted
Portals & PIDsPortalpetuniaID, name, isDemoPortal
User Portal AccessUserPortalAccessuserId, portalId, role
Admin FlagsAdminuserId, isPlatformAdmin, isDemoAdmin
CompaniesCompanyname
Clients (legacy)Clientname, petId

Current Database State

After running the seed script, you should see:

Users (2):

  • admin@example.com
  • demo@example.com

Portals (1 by default):

  • Demo Company (PID: PID-DEMO-001) ← Demo portal

Need additional QA tenants for a disposable environment? Create them manually after running the default seed (or maintain a separate helper script) so the canonical seed continues to provision Demo Company only.

Troubleshooting

Can't see a table?

  • Make sure you're in "Table Editor" not "Authentication"
  • Table names are case-sensitive in PostgreSQL
  • Use double quotes in SQL: "Portal" not Portal

PIDs not showing?

  • PIDs are in the petuniaID column in the Portal table
  • They're stored as TEXT (strings), not numbers