Skip to content

public.voucher

Description

Columns

Name Type Default Nullable Children Parents Comment
id uuid false public.payment public.voucher_redemption public.refund public.voucher_reservation Unique identifier for the voucher(DC2Type:uuid)
code varchar(255) false Unique voucher code used for redemption
owner_id uuid true public.user User who is intended to receive the voucher(DC2Type:uuid)
amount_amount bigint false
amount_currency character(3) false (DC2Type:currency)
title varchar(255) NULL::character varying true Display title/name of the voucher
type varchar(255) 'ABSOLUTE'::character varying false Type of voucher: ABSOLUTE (fixed amount) or PERCENTAGE (percent discount)
percentage integer true Percentage discount value (1-100) when type is PERCENTAGE
created_by_id uuid true public.user User who created the voucher(DC2Type:uuid)
expires_at timestamp(0) with time zone NULL::timestamp with time zone false Date and time when the voucher expires(DC2Type:datetimetz_immutable)
created_at timestamp(0) with time zone NULL::timestamp with time zone false Date and time when the voucher was created(DC2Type:datetimetz_immutable)
blocked_by_id uuid true public.user User who blocked/suspended the voucher(DC2Type:uuid)
blocked_at timestamp(0) with time zone NULL::timestamp with time zone true Date and time when the voucher was blocked(DC2Type:datetimetz_immutable)
allowed_redemptions integer 1 false Total number of times this voucher can be redeemed across all users
note text true Internal notes or description about the voucher
status varchar(255) NULL::character varying false Current status: ISSUED, PARTIALLY_REDEEMED, FULLY_REDEEMED, or SUSPENDED
kind varchar(255) 'ISSUED'::character varying false Current kind/category: REFUND, ISSUED, RESIDUAL, GIFT, or PROMOTION
max_redemptions_per_user integer 1 false Maximum number of times a single user can redeem this voucher
original_kind varchar(255) NULL::character varying false Original kind/category of the voucher before any transformations

Constraints

Name Type Definition
fk_1392a5d81da661f8 FOREIGN KEY FOREIGN KEY (blocked_by_id) REFERENCES "user"(id)
fk_1392a5d87e3c61f9 FOREIGN KEY FOREIGN KEY (owner_id) REFERENCES "user"(id)
fk_1392a5d8b03a8386 FOREIGN KEY FOREIGN KEY (created_by_id) REFERENCES "user"(id)
voucher_pkey PRIMARY KEY PRIMARY KEY (id)

Indexes

Name Definition
voucher_pkey CREATE UNIQUE INDEX voucher_pkey ON public.voucher USING btree (id)
idx_1392a5d81da661f8 CREATE INDEX idx_1392a5d81da661f8 ON public.voucher USING btree (blocked_by_id)
idx_1392a5d87e3c61f9 CREATE INDEX idx_1392a5d87e3c61f9 ON public.voucher USING btree (owner_id)
idx_1392a5d8b03a8386 CREATE INDEX idx_1392a5d8b03a8386 ON public.voucher USING btree (created_by_id)
uniq_1392a5d877153098 CREATE UNIQUE INDEX uniq_1392a5d877153098 ON public.voucher USING btree (code)

Relations

er


Generated by tbls