Merge main into front-7a
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> # Conflicts: # .gitea/workflows/deploy.yml
This commit is contained in:
@@ -631,3 +631,25 @@ ON CONFLICT (letter) DO NOTHING;
|
||||
-- product: base price, then "from 5 m R$ Y", "from 20 m R$ Z" (jsonb list of
|
||||
-- {"from_metres": "5", "unit_cents": 1990}, strictly increasing, at most 5).
|
||||
ALTER TABLE dtf_local.product_prices ADD COLUMN IF NOT EXISTS bands jsonb NOT NULL DEFAULT '[]';
|
||||
|
||||
-- Front 8.3: discount coupons, created in the Kanban's Site tab. The id is
|
||||
-- generated in Python (schema.sql does not use gen_random_uuid). A deleted
|
||||
-- code may be created again; the orders that used it keep its id and code.
|
||||
CREATE TABLE IF NOT EXISTS dtf_local.coupons (
|
||||
id uuid PRIMARY KEY,
|
||||
code text NOT NULL CHECK (code ~ '^[A-Z0-9-]{3,30}$'),
|
||||
kind text NOT NULL CHECK (kind IN ('percent','per_metre')),
|
||||
value integer NOT NULL CHECK (value > 0), -- percent: 1..90; per_metre: cents per billed metre
|
||||
valid_from timestamptz NOT NULL DEFAULT now(),
|
||||
valid_until timestamptz,
|
||||
min_metres numeric(8,1),
|
||||
max_uses integer CHECK (max_uses > 0),
|
||||
max_uses_per_customer integer CHECK (max_uses_per_customer > 0),
|
||||
product text CHECK (product IN ('file','avulsa','uvfile','uv')), -- NULL = every product
|
||||
note text NOT NULL DEFAULT '',
|
||||
paused boolean NOT NULL DEFAULT false,
|
||||
deleted_at timestamptz,
|
||||
created_by text NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS coupons_live_code ON dtf_local.coupons(code) WHERE deleted_at IS NULL;
|
||||
|
||||
Reference in New Issue
Block a user