* create sales table * moved * moved file * fixed from feedback * fixed * must be unique * move file
14 lines
812 B
SQL
14 lines
812 B
SQL
DROP TABLE IF EXISTS sales;
|
|
|
|
CREATE TABLE sales (
|
|
id SERIAL PRIMARY KEY, -- Auto-incremented unique ID
|
|
sale_id TEXT NOT NULL UNIQUE, -- Sale ID used for tracking
|
|
name TEXT NOT NULL, -- Name for admin visual purposes
|
|
start_time TIMESTAMP WITHOUT TIME ZONE NOT NULL, -- Start time that is non timezone specific
|
|
end_time TIMESTAMP WITHOUT TIME ZONE NOT NULL, -- End time that is non timezone specific
|
|
active BOOLEAN NOT NULL DEFAULT TRUE, -- Boolean flag to indicate if the sale is active
|
|
discount_percent INT CHECK (discount_percent BETWEEN 1 AND 40), -- Discount percentage (1-40)
|
|
segmentation JSONB NOT NULL DEFAULT '{ "include_markets": [], "exclude_markets": [], "designers": [], "product_types": [], "products": []}'::jsonb -- JSON object for segmentation settings
|
|
);
|
|
|