Files
database/migrations/000.535.sql
T
Arwid ThornströmandGitHub a12e60368a create sales table (#458)
* create sales table

* moved

* moved file

* fixed from feedback

* fixed

* must be unique

* move file
2025-02-06 10:40:45 +01:00

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
);