Skip to content

public.coupons

Description

Labels

svc-smarttab

Columns

NameTypeDefaultNullableChildrenParentsComment
idintegernextval('coupons_id_seq'::regclass)falsepublic.bills
merchant_idintegerfalsepublic.merchants
coupon_codevarchar(50)false
coupon_namevarchar(255)false
discount_typevarchar(20)false
discount_valuenumeric(10,2)false
min_purchase_amountnumeric(12,2)true
max_discount_amountnumeric(12,2)true
valid_fromdatefalse
valid_todatefalse
max_usesintegertrue
max_uses_per_customerintegertrue
current_usesinteger0true
applicable_store_idsjsonbtrue
is_activebooleantruetrue
created_attimestamp with time zonenow()true
updated_attimestamp with time zonenow()true

Viewpoints

NameDefinition
Order & BillingOrder lifecycle — Orders → Bills → Payments → Settlements

Constraints

NameTypeDefinition
coupons_dates_checkCHECKCHECK ((valid_to >= valid_from))
coupons_discount_type_checkCHECKCHECK (((discount_type)::text = ANY ((ARRAY['percentage'::character varying, 'fixed_amount'::character varying])::text[])))
coupons_merchant_id_fkeyFOREIGN KEYFOREIGN KEY (merchant_id) REFERENCES merchants(id) ON DELETE CASCADE
coupons_pkeyPRIMARY KEYPRIMARY KEY (id)
uq_coupons_merchant_coupon_codeUNIQUEUNIQUE (merchant_id, coupon_code)

Indexes

NameDefinition
coupons_pkeyCREATE UNIQUE INDEX coupons_pkey ON public.coupons USING btree (id)
uq_coupons_merchant_coupon_codeCREATE UNIQUE INDEX uq_coupons_merchant_coupon_code ON public.coupons USING btree (merchant_id, coupon_code)
ix_coupons_merchant_idCREATE INDEX ix_coupons_merchant_id ON public.coupons USING btree (merchant_id)

Relations


Generated by tbls

MPAC — MP-Solution Advanced Cloud Service