mirror of
https://github.com/Traceworks2023/nxtgauge-backend-rust.git
synced 2026-06-10 20:01:28 +00:00
13 lines
555 B
MySQL
13 lines
555 B
MySQL
|
|
-- Admin-managed automatic discounts (applied before coupon codes)
|
||
|
|
CREATE TABLE IF NOT EXISTS discounts (
|
||
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||
|
|
title VARCHAR(255) NOT NULL,
|
||
|
|
scope VARCHAR(20) NOT NULL DEFAULT 'ROLE', -- ROLE, PACKAGE
|
||
|
|
role_key VARCHAR(50),
|
||
|
|
package_id UUID REFERENCES pricing_packages(id) ON DELETE SET NULL,
|
||
|
|
discount_type VARCHAR(20) NOT NULL, -- PERCENT, FIXED
|
||
|
|
discount_value INTEGER NOT NULL,
|
||
|
|
is_active BOOLEAN NOT NULL DEFAULT true,
|
||
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||
|
|
);
|