discount_redemptions table

The discount_redemptions table in the E-commerce Database Schema schema has 6 columns, keyed by id, with 3 foreign keys to discounts, orders and customers.

The per-customer index is what enforces one-use-per-shopper promotions.

Columns (6)

Columns of the discount_redemptions table
ColumnTypeConstraintsDescription
iduuidprimary key
discount_iduuidnot null, references discounts.id
order_iduuidnot null, references orders.id
customer_iduuidnot null, references customers.id
amount_centsintegernot null
redeemed_attimestamptznot null

Indexes (2)

  • (discount_id, order_id) unique
  • (discount_id, customer_id)

Relationships