order_product

Description

Product information of order.

Definition

Column Type Constraint Description
shop TEXT PRIMARY KEY Shop ID. (shop.username)
order_id INTEGER Order ID. (order.id)
index INTEGER Index of products in added order. 0-origin.
product_id INTEGER NOT NULL Product ID. Product that has same id may be different one when it was ordered. (product.id)
price INTEGER NOT NULL Unit price at when it was ordered. Tax excluded.
quantity INTEGER NOT NULL Quantity. (>= 1.)

Related tables

Query

CREATE TABLE order_product(
shop        TEXT,
order_id    INTEGER,
index       INTEGER,
product_id  INTEGER  NOT NULL,
price       INTEGER  NOT NULL,
quantity    INTEGER  NOT NULL,
PRIMARY KEY(shop, order_id, index)
);