Skip to main content

Order Data Model

This lesson connects the architecture model to persistent data. You will create an ERD for the order subsystem, add the orders and order_items tables, and document their one-to-many relationship.

Build the order ERD from tables, columns, and cardinalities.

Create the ERD​

Create a diagram named Order data model, select the ERD type, and bind it to the checkout and order subsystem described by the model.

Loading image...
The diagram is bound to the subsystem whose persistent data it describes

Tables and Columns​

Add the orders table with its identifier, customer, status, and creation timestamp. Add order_items with identifiers for the order and product, plus the quantity.

Loading image...
Required columns and their data types are visible directly on the diagram
Loading image...
The item table keeps the order reference, product, and quantity

Relationship and Cardinalities​

Create a relationship from orders to order_items. Set the source to exactly one and the target to one or more, then switch the item table to a compact view.

Loading image...
The cardinalities state that one order contains one or more line items
Loading image...
The compact diagram documents the storage structure without unnecessary detail

Timeline​

  • 00:00 — purpose of the data model;
  • 00:06 — creating and binding the ERD;
  • 00:35 — adding the orders table;
  • 01:02 — defining columns;
  • 01:42 — adding order items;
  • 02:20 — relationship and cardinalities;
  • 02:50 — compact final diagram.

Previous lesson: Your First Component Interface.

Next lesson: First Class Diagram.