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
- Click Open in the editor. The ER diagram opens on a new page in FlowDiagram — nothing is uploaded and there is no sign-up.
- Rename, add or delete shapes and drag them where you want; connectors stay attached as things move.
- 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.
- Prefer text? Edit the DBML below and paste it in through ☰ → Import diagram; the finished model exports to SQL DDL or back to DBML.
- 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