This commit is contained in:
CFOU
2026-09-14 20:50:19 +02:00
commit 3091fb4020
135 changed files with 10262 additions and 0 deletions
@@ -0,0 +1,12 @@
CREATE TABLE price_tiers (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
product_id UUID NOT NULL REFERENCES products(id) ON DELETE CASCADE,
unit_id UUID NOT NULL REFERENCES units(id) ON DELETE RESTRICT,
quantity NUMERIC(14, 3) NOT NULL CHECK (quantity > 0),
price_cents BIGINT NOT NULL CHECK (price_cents >= 0),
position INT NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_price_tiers_product_id ON price_tiers(product_id);