Tables in this data model
- clients — 3 columns
- attorneys — 3 columns
- matters — 6 columns
- parties — 4 columns
- documents — 5 columns
- deadlines — 4 columns
- time_entries — 5 columns
- invoices — 5 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 SQL DDL below and paste it in through ☰ → Import / export SQL; the finished model exports back to DDL.
- Export to PNG, SVG or PDF, or press Ctrl+L for a link that carries the whole diagram.
SQL DDL 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.
CREATE TABLE clients (
client_id INTEGER NOT NULL PRIMARY KEY,
name VARCHAR(150) NOT NULL,
contact_email VARCHAR(255)
);
CREATE TABLE attorneys (
attorney_id INTEGER NOT NULL PRIMARY KEY,
full_name VARCHAR(150) NOT NULL,
hourly_rate DECIMAL(8,2) NOT NULL
);
CREATE TABLE matters (
matter_id INTEGER NOT NULL PRIMARY KEY,
client_id INTEGER NOT NULL REFERENCES clients(client_id),
lead_attorney_id INTEGER NOT NULL REFERENCES attorneys(attorney_id),
matter_type VARCHAR(80) NOT NULL,
opened_on DATE NOT NULL,
status VARCHAR(30) NOT NULL
);
CREATE TABLE parties (
party_id INTEGER NOT NULL PRIMARY KEY,
matter_id INTEGER NOT NULL REFERENCES matters(matter_id),
name VARCHAR(150) NOT NULL,
role VARCHAR(40) NOT NULL
);
CREATE TABLE documents (
document_id INTEGER NOT NULL PRIMARY KEY,
matter_id INTEGER NOT NULL REFERENCES matters(matter_id),
title VARCHAR(200) NOT NULL,
privileged BOOLEAN,
filed_on DATE
);
CREATE TABLE deadlines (
deadline_id INTEGER NOT NULL PRIMARY KEY,
matter_id INTEGER NOT NULL REFERENCES matters(matter_id),
description VARCHAR(200) NOT NULL,
due_on DATE NOT NULL
);
CREATE TABLE time_entries (
entry_id INTEGER NOT NULL PRIMARY KEY,
matter_id INTEGER NOT NULL REFERENCES matters(matter_id),
attorney_id INTEGER NOT NULL REFERENCES attorneys(attorney_id),
hours DECIMAL(5,2) NOT NULL,
logged_on DATE NOT NULL
);
CREATE TABLE invoices (
invoice_id INTEGER NOT NULL PRIMARY KEY,
matter_id INTEGER NOT NULL REFERENCES matters(matter_id),
amount DECIMAL(12,2) NOT NULL,
issued_on DATE NOT NULL,
paid_on DATE
);
Related: ER diagram from SQL · All legal & compliance templates · All 521 templates