Entity order

A placed order.

Terms: Order

Subject areas: Sales

Attributes

#NameTypeNullDefaultKeyTermsDescription
1idbigintnoPK
2customer_idbigintnoFK
3coupon_idbigintyesFK
4statusenum order_statusno"pending"
5totaldomain money (decimal(12, 2))no0
6placed_attimestamptznoexpr "now()"

Keys

KindNameAttributes
primarypk_orderid

Relationships

NameRoleOther entityCardinalityAttributesIdentifyingOn deleteOn update
order_couponchildcouponzero_or_one to manyorder.coupon_id -> coupon.idnoset_nullno_action
order_customerchildcustomerone to manyorder.customer_id -> customer.idnorestrictno_action
order_line_orderparentorder_lineone to one_or_manyorder_line.order_id -> order.idyescascadeno_action
payment_orderparentpaymentone to manypayment.order_id -> order.idnono_actionno_action

Physical

lite (sqlite): main.order

#NameTypeNullDefaultIdentityCollationAttributeComment
1idintegernoby_defaultid
2customer_idintegernocustomer_id
3coupon_idintegeryescoupon_id
4statusorder_statusno"pending"status
5totalnumericno0total
6placed_attextnoexpr "CURRENT_TIMESTAMP"placed_at

pg (postgresql): public.order

A placed order.

#NameTypeNullDefaultIdentityCollationAttributeComment
1idbigintnoalwaysid
2customer_idbigintnocustomer_id
3coupon_idbigintyescoupon_id
4statusorder_statusno"pending"status
5totalnumeric(12, 2)no0total
6placed_attimestamp with time zonenoexpr "now()"placed_at

Triggers

NameTimingEventsLevelAction
trg_order_touchbeforeupdaterowfunction set_updated_at