ExpertClassPromotionCodes


Description

A customer-redeemable promotion code for an Expert Class.

Columns

Column Type Size Nulls Auto Default Children Parents Comments
id uuid 2147483647 public.gen_random_uuid()
ExpertClassCategoryExpertClassPromotionCodes.PromotionCodeId ExpertClassCategoryExpertClassPromotionCod_PromotionCodeId_fkey C
ExpertClassClassTypeExpertClassPromotionCodes.PromotionCodeId ExpertClassClassTypeExpertClassPromotionCo_PromotionCodeId_fkey C
ExpertClassExpertClassPromotionCodes.PromotionCodeId ExpertClassExpertClassPromotionCodes_PromotionCodeId_fkey C
ExpertClassPromotionCodeActionLogs.PromotionCodeId ExpertClassPromotionCodeActionLogs_PromotionCodeId_fkey R
ExpertClassPromotionCodeEmails.PromotionCodeId ExpertClassPromotionCodeEmails_PromotionCodeId_fkey C
ExpertClassPromotionCodePlatformRestrictions.promotionCodeId ExpertClassPromotionCodePlatformRestrictions_promotionCodeId_fk C
OdysseyRewards.ExpertClassPromoId OdysseyRewards_ExpertClassPromoId_fkey R
Orders.PromotionCodeId Orders_PromotionCodeId_fkey R
name varchar 255 null

Name of the promotion code. This is displayed to business users to help identify each promotion code.

code varchar 255 null

The customer-facing code. This code must be unique across all active promotion codes.

percentOff int4 10 null

Percent that will be taken off the amount of any order while the promotion code is active.

active bool 1 null

Whether the promotion code is currently active.

createdAt timestamptz 35,6 now()
updatedAt timestamptz 35,6 null
deletedAt timestamptz 35,6 null
expiresAt timestamptz 35,6 null
maxAmountDiscount numeric 19,4 null

Maximum amount of discount

minExpertClassPriceToApply numeric 19,4 null

Minimum price of expert class to apply this promo code

maxUsagePerUser int4 10 null
maxUsage int4 10 null
isAutoApplied bool 1 false

Whether the promotion code can be auto applied to expert class tickets as default discount.

startsAt timestamptz 35,6 now()

Indexes

Constraint Name Type Sort Column(s)
ExpertClassPromotionCodes_pkey Primary key Asc id
ExpertClassPromotionCodes_active_idx Performance Asc active
ExpertClassPromotionCodes_code_active_idx Must be unique Asc/Asc code + active
ExpertClassPromotionCodes_expiresAt_idx Performance Asc expiresAt
ExpertClassPromotionCodes_isAutoApplied_idx Performance Asc isAutoApplied
ExpertClassPromotionCodes_startsAt_idx Performance Asc startsAt

Check Constraints

Constraint Name Constraint
ExpertClassPromotionCodes_startsAt_check ((("expiresAt" IS NULL) OR ("startsAt" <= "expiresAt"))) NOT VALID
ExpertClassPromotionCodes_code_lowercase_check (((code)::text = lower((code)::text)))
ExpertClassPromotionCodes_maxAmountDiscount_check (((("maxAmountDiscount" IS NOT NULL) AND ("maxAmountDiscount" > (0)::numeric)) OR ("maxAmountDiscount" IS NULL)))
ExpertClassPromotionCodes_minExpertClassPriceToApply_check (((("minExpertClassPriceToApply" IS NOT NULL) AND ("minExpertClassPriceToApply" > (0)::numeric)) OR ("minExpertClassPriceToApply" IS NULL)))

Relationships