Skip to content
Docs
On this page Workspaces own the data 1/5
Internal — not published

All data lives in one Postgres database, split into five areas: accounts, CRM, content, automation and analytics. The vector extension is installed for Knowledge search and lead memory. The schema is written for the Prisma ORM, which also generates the database client the backend uses.

The data, grouped by concept
Workspace and team
  • Workspace and its settings
  • User (a login)
  • Membership with a role
  • Invite
  • Connected account
People and companies
  • Person
  • Channel identity and its opt-out
  • Company
  • Global company pool
  • Tag
  • Audience and its rule
Sales work
  • Deal
  • Task
  • Note
  • Fit criterion of a product
  • Fit score on a criterion
Conversation and memory
  • Timeline entry
  • Memory, with a vector
  • Import job
  • Link to a HubSpot or Salesforce record
  • Mailbox read position
Content
  • Product
  • Knowledge document
  • Chunk, with a vector
  • Template
Campaigns
  • Campaign and its builder graph
  • Trigger
  • Run
  • Workflow (one person in one run)
  • Step result
Measurement and plumbing
  • Analytics event
  • Daily rollup
  • AI model call log
  • Event bus delivery
  • Lock
belongs to one workspace belongs to a workspace through its parent shared across workspaces, or outside them

Workspaces own the data

Almost every record belongs to one workspace, either directly or through the record it hangs off (a fit score through its person, a step result through its workflow). Deleting a workspace deletes every record that belongs to it, directly or through a parent.

A few things sit outside any one workspace:

  • Users. A login can belong to several workspaces.
  • Channel identities. An email address or a LinkedIn profile is stored once and linked to the person in each workspace that has it, opt-out included.
  • The global company pool, which every workspace can read and only the system writes.
  • The event bus deliveries and the locks, which are plumbing for the whole installation.

Relations worth knowing

  • A person and a channel identity are linked many to many. A person has several identities, and one identity can belong to people in several workspaces.
  • An audience has hand-added members as a stored link. The people its rule matches are never stored; see CRM.
  • Some references are loose, a kind and an id with no database link: tasks and notes point at a person, deal or company; analytics events point at their subject; timeline entries point at their source; imported records point at what they became. Services clean these up, or leave them on purpose: deleting a person keeps their notes and tasks.
  • Deleting a person deletes their channel links, deals, timeline, fit scores, memories and campaign workflows.
  • A person is in a campaign run at most once, and a workflow runs each step at most once.
  • Fit scores are append-only. Each is a number from -1 to 1 for one person on one criterion.
  • Products and fit criteria are hidden when deleted. Everything else is deleted for real.
  • Several shapes are stored as JSON: workspace and user settings, the data and options of a connected account, audience rules, the campaign builder graph, template content, event details and the data of a timeline entry. The database does not check them. Their shapes are defined in the code that reads them.

Vector columns

Knowledge chunks and lead memories carry vectors in a column without a fixed size, so any embedding model works. Each row records the model and the size. The ORM cannot read or write that column type, so the Knowledge and memory code uses plain SQL for it. Approximate nearest-neighbour indexes cover 384, 768, 1,024 and 1,536 dimensions, one partial index per size.

How schema changes reach the database

The repository has no migration history. Changes reach the database in two ways:

WayUsed forHow
Schema pushEvery change the ORM can expressIn the dev compose profile, a one-off service pushes the schema before the backend starts. It refuses a change that would drop data and exits with an error; docker compose logs db-push shows why.
Manual SQLChanges that move data, or that the ORM cannot expressPlain SQL in one transaction, run with psql -v ON_ERROR_STOP=1 -f <file>. Each file’s header says what it does and whether it must run before the push.

The manual changes so far:

DateWhat it does
2026-06-10Splits a product’s single linked account into its own AI account and a list of sending accounts, carrying the existing links over
2026-08-12Remaps old fit criterion weights 2, 3 and 5 to 25, 55 and 85, and fails if any other old value is left
2026-10-12Creates the storage for the durable event bus
2026-10-23Lets vectors be any size, records each vector’s model, size and page, and creates the per-size indexes. Must run before the push on an existing database, or the push drops and recreates the column and the stored vectors are lost.

On an existing database, run the new manual files first, then push. On a new database, the push creates everything; of the manual files only the index part of the 2026-10-23 change adds anything, and the 2026-06-10 file fails because the column it reads never existed. Production steps, backups and rollback are on Deployment and operations.

Seed data

A demo seed fills one user’s workspace with demo people, companies, deals, products, Knowledge documents and campaigns. It upserts by stable keys, so a second run updates the same records. It uses the configured database and falls back to the local compose database. An older seed always targets the local database, whatever is configured. How to run them is on Local development.

Docs
EN VI