Entity order_line
Subject areas: Sales
Attributes
| # | Name | Type | Null | Default | Key | Terms | Description |
|---|---|---|---|---|---|---|---|
| 1 | order_id | bigint | no | PK, FK | |||
| 2 | line_no | integer | no | PK | |||
| 3 | product_id | bigint | no | FK | |||
| 4 | qty | integer | no | 1 | |||
| 5 | unit_price | domain money (decimal(12, 2)) | no | 0 |
Keys
| Kind | Name | Attributes |
|---|---|---|
| primary | pk_order_line | order_id, line_no |
Relationships
| Name | Role | Other entity | Cardinality | Attributes | Identifying | On delete | On update |
|---|---|---|---|---|---|---|---|
| order_line_order | child | order | one to one_or_many | order_line.order_id -> order.id | yes | cascade | no_action |
| order_line_product | child | product | one to many | order_line.product_id -> product.id | no | no_action | no_action |
Physical
lite (sqlite): main.order_line
| # | Name | Type | Null | Default | Identity | Collation | Attribute | Comment |
|---|---|---|---|---|---|---|---|---|
| 1 | order_id | integer | no | order_id | ||||
| 2 | line_no | integer | no | line_no | ||||
| 3 | product_id | integer | no | product_id | ||||
| 4 | qty | integer | no | 1 | qty | |||
| 5 | unit_price | numeric | no | 0 | unit_price |
- primary key pk_order_line (order_id, line_no)
- foreign key fk_order_line_order (order_id) references order (id) on delete cascade
- foreign key fk_order_line_product (product_id) references product (id)
- index ix_order_line_product (product_id)
pg (postgresql): public.order_line
| # | Name | Type | Null | Default | Identity | Collation | Attribute | Comment |
|---|---|---|---|---|---|---|---|---|
| 1 | order_id | bigint | no | order_id | ||||
| 2 | line_no | integer | no | line_no | ||||
| 3 | product_id | bigint | no | product_id | ||||
| 4 | qty | integer | no | 1 | qty | |||
| 5 | unit_price | numeric(12, 2) | no | 0 | unit_price |
- primary key pk_order_line (order_id, line_no)
- foreign key fk_order_line_order (order_id) references order (id) on delete cascade
- foreign key fk_order_line_product (product_id) references product (id)
- index ix_order_line_product (product_id)