Database Reference
This page lists Track's domain tables. All tables live in your own Supabase project — not ARK's. Row-Level Security is enabled on every table; policies scope rows to the user's workspace.
Shared platform tables
These are shared with other ARK products if you run Track in the same Supabase project.
| Table | Purpose |
|---|---|
profiles | Extends auth.users with name, avatar, workspace role. |
workspaces | Top-level tenant boundary. |
workspace_members | Join table: user ↔ workspace with role. |
audit_log | Who did what and when. |
Track domain tables
boards
One row per pipeline.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
workspace_id | uuid FK → workspaces | |
name | text | |
record_type | text | contact, company, or deal. |
is_archived | bool | |
created_by | uuid FK → auth.users | |
created_at | timestamptz |
board_stages
Columns on a board.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
board_id | uuid FK → boards | |
name | text | |
position | int | Ordering. |
stage_type | text | open, won, lost. |
probability | numeric | 0–100, optional. |
board_cards
A card on a board — references the underlying record.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
board_id | uuid FK → boards | |
stage_id | uuid FK → board_stages | |
record_type | text | Matches the board's. |
record_id | uuid | FK to contacts/companies/deals (soft). |
position | int | Ordering within a stage. |
contacts
Person records.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
workspace_id | uuid FK → workspaces | |
name, email, phone, title | text | |
company_id | uuid FK → companies | Nullable. |
owner_id | uuid FK → auth.users | Nullable. |
tags | text[] | |
custom_fields | jsonb | Validated at app layer. |
deleted_at | timestamptz | Soft delete. |
companies
Organization records.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
workspace_id | uuid FK → workspaces | |
name, domain, industry, size | text | |
parent_id | uuid FK → companies | Nullable. |
owner_id | uuid FK → auth.users | |
custom_fields | jsonb | |
deleted_at | timestamptz |
deals
Opportunity records.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
workspace_id | uuid FK → workspaces | |
name | text | |
value_cents | bigint | Minor units. |
currency | text | ISO 4217. |
stage_id | uuid FK → board_stages | |
close_date | date | |
probability | numeric | |
primary_contact_id | uuid FK → contacts | |
company_id | uuid FK → companies | |
owner_id | uuid FK → auth.users | |
custom_fields | jsonb | |
deleted_at | timestamptz |
deal_contacts
Many-to-many between deals and contacts (besides the primary).
| Column | Type | Notes |
|---|---|---|
deal_id | uuid FK → deals | |
contact_id | uuid FK → contacts | |
role | text | Free-form (decision-maker, champion, etc.). |
timeline_entries
Notes, calls, emails, and auto-logged events on records.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
workspace_id | uuid FK → workspaces | |
record_type | text | contact, company, deal. |
record_id | uuid | |
entry_type | text | note, call, email, meeting, stage_change, field_edit, task. |
author_id | uuid FK → auth.users | |
body | text | Markdown for notes; structured JSON in payload for typed events. |
payload | jsonb | Type-specific details. |
created_at | timestamptz |
tasks
Actionable todos tied to records.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
workspace_id | uuid FK → workspaces | |
record_type, record_id | text, uuid | Parent record. |
title, description | text | |
assigned_to | uuid FK → auth.users | |
due_date | date | |
status | text | open, in_progress, done. |
source_entry_id | uuid FK → timeline_entries | Nullable. |
custom_fields
Schema for user-defined fields.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
workspace_id | uuid FK → workspaces | |
record_type | text | contact, company, deal. |
name | text | UI label. |
key | text | Stable key used in custom_fields jsonb. |
type | text | text, number, date, select, multi_select, boolean, url, currency, link. |
config | jsonb | Type-specific (options, validation rules). |
searchable | bool | Included in full-text index. |
automations
User-defined automation rules.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
workspace_id | uuid FK → workspaces | |
name | text | |
trigger | jsonb | {type, params}. |
conditions | jsonb | Array of filter predicates. |
actions | jsonb | Array of action definitions. |
is_enabled | bool |
automation_runs
Execution log.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
automation_id | uuid FK → automations | |
record_id | uuid | |
status | text | success, failed. |
duration_ms | int | |
error | text | Null on success. |
run_at | timestamptz |
search_index
Materialized search vectors.
| Column | Type | Notes |
|---|---|---|
id | uuid PK | |
workspace_id | uuid FK → workspaces | |
record_type | text | |
record_id | uuid | |
tsv | tsvector | GIN-indexed. |
trigram | text | pg_trgm fuzzy fallback. |
Relationships at a glance
workspaces
├─ boards
│ └─ board_stages
│ └─ board_cards ──► contacts / companies / deals
├─ contacts ──► companies (optional)
├─ companies
├─ deals ──► contacts (primary + deal_contacts)
│ └─ board_stages
├─ timeline_entries (polymorphic on record)
├─ tasks (polymorphic on record)
├─ custom_fields (per record_type)
├─ automations
│ └─ automation_runs
└─ search_index (polymorphic)
Row-Level Security summary
- Every domain table has a policy:
workspace_id = user's workspace. auth.uid()is resolved at query time.- The admin client (service role) bypasses RLS — used only by Edge
Functions that legitimately need cross-workspace access (the
automation runner, the webhook dispatcher). See
CLAUDE.mdin your Track repo for the security rules that enforce this.