AI draft example
Create an ERD Draft with AI
A practical example of asking AI for an ERD draft and reviewing the tables, keys, relationships, and history model.
Scenario
Create an ERD Draft with AI
An AI-assisted workflow for drafting a customer support ticket ERD and reviewing it before implementation.
Input
Requirements and constraints
AI output
Draft tables and relationships
Human review
Keys, status, permissions, history
Requirements
Requirements
- Customers create tickets and agents reply.
- Tickets have priority, status, assignee, and category.
- Tickets contain messages and attachments.
- Status changes must be stored as history.
Table design
Table design
customersSupport customers- id PK
- email UNIQUE
- name
- created_at
agentsSupport agents- id PK
- email UNIQUE
- name
- status
ticketsSupport tickets- id PK
- customer_id FK
- assigned_agent_id FK
- category_id FK
- status
- priority
ticket_messagesTicket conversation- id PK
- ticket_id FK
- sender_type
- sender_id
- body
ticket_attachmentsMessage files- id PK
- message_id FK
- file_url
- file_name
ticket_status_eventsStatus history- id PK
- ticket_id FK
- from_status
- to_status
- changed_at
Relationships
Relationships
customers 1:N ticketsagents 1:N ticketstickets 1:N ticket_messagesticket_messages 1:N ticket_attachmentstickets 1:N ticket_status_events
Design notes
Design notes
Check missing relationships first
If an AI draft links attachments directly to tickets, verify whether the product actually needs message-level attachments.
Use polymorphic senders carefully
ticket_messages.sender_type and sender_id can work, but a shared users table may be better when joins and permissions matter.
Keep current status separate from history
tickets.status is current state. ticket_status_events stores the sequence of changes.
Implementation checks
Implementation checks
- Review AI-generated column names and database types before implementation.
- Restrict status values with enum or check constraints.
- Review attachment access and retention as separate requirements.
More ERD examples
More ERD examples
Use these structures as a starting point, or open a demo canvas before creating an account.