Skip to content

public.discount

Description

Columns

Name Type Default Nullable Children Parents Comment
id uuid false public.match_player public.match_series Unique identifier of the discount.(DC2Type:uuid)
group_id uuid true public.user_group User group to which this discount applies.(DC2Type:uuid)
created_at timestamp(0) with time zone false The date and time when the discount was created.(DC2Type:datetimetz_immutable)
valid_from timestamp(0) with time zone false Start date and time from which the discount becomes valid.(DC2Type:datetimetz_immutable)
valid_till timestamp(0) with time zone false End date and time until which the discount remains valid.(DC2Type:datetimetz_immutable)
percentage integer false Discount percentage applied (1-100). When 100% with maxPlayableHoursInValidityPeriod set, becomes a quota.
is_enabled boolean false Whether this discount is currently enabled and can be used.
applicable_on_days text false Days of the week when discount is applicable (MONDAY, TUESDAY, etc.).(DC2Type:simple_array)
applicable_from_time time(0) without time zone NULL::time without time zone false Start time of day when discount becomes applicable (HH:MM format).(DC2Type:time_immutable)
applicable_till_time time(0) without time zone NULL::time without time zone false End time of day until which discount is applicable (HH:MM format, 00:00 indicates next day midnight).(DC2Type:time_immutable)
applicable_on_sports text false Sports for which the discount is applicable.(DC2Type:simple_array)
applicable_on_locations text false Club locations where the discount is applicable.(DC2Type:simple_array)
max_playable_hours_in_validity_period integer true Maximum number of hours that can be played with this discount during the validity period. Used for quota management.
kind varchar(255) NULL::character varying true Type of discount: DISCOUNT (percentage-based) or QUOTA (100% with hour limit).
played_hours_in_validity_period double precision 0 false Total hours already played using this discount during the validity period.
played_hours_last_computed_at timestamp(0) with time zone NULL::timestamp with time zone true Timestamp of the last computation of played hours.(DC2Type:datetimetz_immutable)
origin varchar(255) NULL::character varying false Origin of the discount: MATCH_SERIES (from tournament), MANUAL (manually created), or WELLPASS (corporate benefit).

Constraints

Name Type Definition
fk_e1e0b40efe54d947 FOREIGN KEY FOREIGN KEY (group_id) REFERENCES user_group(id)
discount_pkey PRIMARY KEY PRIMARY KEY (id)

Indexes

Name Definition
discount_pkey CREATE UNIQUE INDEX discount_pkey ON public.discount USING btree (id)
idx_e1e0b40efe54d947 CREATE INDEX idx_e1e0b40efe54d947 ON public.discount USING btree (group_id)

Relations

er


Generated by tbls