From a12e60368a9737a9eeb2b0f3549df0f01c57ae02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arwid=20Thornstr=C3=B6m?= Date: Thu, 6 Feb 2025 10:40:45 +0100 Subject: [PATCH] create sales table (#458) * create sales table * moved * moved file * fixed from feedback * fixed * must be unique * move file --- migrations/000.535.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 migrations/000.535.sql diff --git a/migrations/000.535.sql b/migrations/000.535.sql new file mode 100644 index 0000000..24fd7ac --- /dev/null +++ b/migrations/000.535.sql @@ -0,0 +1,13 @@ +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 +); +