FlowDiagram
Database & ER modelsDBML

CRM schema template

Companies, contacts, leads, deals, pipeline stages, activities and owners — a Salesforce/HubSpot-style data model. This data model has 8 tables and 38 columns, joined by 12 relationships. FlowDiagram draws it as an entity-relationship diagram with crow's-foot notation.

Open in the editor →
  • Free — no account, no trial, no watermark
  • Fully editable shapes and connectors, not a screenshot
  • Export PNG, SVG or PDF, or share it as a link
  • Private: the diagram never leaves your browser

Tables in this data model

  • users — 3 columns
  • companies — 5 columns
  • contacts — 5 columns
  • leads — 5 columns
  • pipeline_stages — 4 columns
  • deals — 6 columns
  • deal_contacts — 4 columns
  • activities — 6 columns

How to use this ER diagram template

  1. Click Open in the editor. The ER diagram opens on a new page in FlowDiagram — nothing is uploaded and there is no sign-up.
  2. Rename, add or delete shapes and drag them where you want; connectors stay attached as things move.
  3. Drop in vendor logos from the library — 1,160 of them, including every AWS, Azure and Google Cloud service icon — or restyle it with the colour and theme controls.
  4. Prefer text? Edit the DBML below and paste it in through ☰ → Import diagram; the finished model exports to SQL DDL or back to DBML.
  5. Export to PNG, SVG or PDF, or press Ctrl+L for a link that carries the whole diagram.

DBML source

The whole template is the text below. Paste it into FlowDiagram, keep it in Git next to the code it describes, or hand it to an AI assistant to extend.

Table users {
  id integer [pk]
  name varchar
  team varchar
}

Table companies {
  id integer [pk]
  owner_id integer [ref: > users.id]
  name varchar
  industry varchar
  employee_count integer
}

Table contacts {
  id integer [pk]
  company_id integer [ref: > companies.id]
  name varchar
  email varchar
  title varchar
}

Table leads {
  id integer [pk]
  owner_id integer [ref: > users.id]
  source varchar
  status varchar
  converted_contact_id integer [ref: > contacts.id]
}

Table pipeline_stages {
  id integer [pk]
  name varchar
  probability integer
  position integer
}

Table deals {
  id integer [pk]
  company_id integer [ref: > companies.id]
  owner_id integer [ref: > users.id]
  stage_id integer [ref: > pipeline_stages.id]
  amount decimal
  close_date date
}

Table deal_contacts {
  id integer [pk]
  deal_id integer [ref: > deals.id]
  contact_id integer [ref: > contacts.id]
  role varchar
}

Table activities {
  id integer [pk]
  deal_id integer [ref: > deals.id]
  contact_id integer [ref: > contacts.id]
  user_id integer [ref: > users.id]
  kind varchar
  occurred_at timestamp
}

Related: Database schema diagram tool · All database & er models templates · All 521 templates