Skip to content

match_edit

A proposed change to a finalized match. Invariants (application): the decider is the match’s recorder; an edit only changes participants of its own match; a new playset is for the match’s game and new expansions belong to it; only the flagged (*_set) fields are written on approval.

Name Type Default Nullable Children Parents Comment
id bigint nextval(‘match_edit_seq’::regclass) false public.match_edit_expansion_change public.match_edit_participant_change public.match_edit_loadout_change
public_id uuid gen_random_uuid() false
match_id bigint false public.match
proposed_by_user_id bigint false public.app_user
playset_set boolean false false The edit replaces the playset with new_playset_id; NULL there clears the playset.
new_playset_id bigint true public.playset
expansions_set boolean false false The edit replaces the expansions with the rows in match_edit_expansion_change; none clears them.
status varchar(16) ‘PENDING’::character varying false
decided_by_user_id bigint true public.app_user
decided_at timestamp with time zone true
created_at timestamp with time zone now() false
updated_at timestamp with time zone true
version bigint false
Name Type Definition
chk_match_edit_decided CHECK CHECK (((((status)::text = ‘PENDING’::text) AND (decided_at IS NULL)) OR (((status)::text <> ‘PENDING’::text) AND (decided_at IS NOT NULL))))
chk_match_edit_playset CHECK CHECK ((playset_set OR (new_playset_id IS NULL)))
chk_match_edit_status CHECK CHECK (((status)::text = ANY ((ARRAY[‘PENDING’::character varying, ‘APPROVED’::character varying, ‘REJECTED’::character varying])::text[])))
fk_match_edit_decided_by_user_id FOREIGN KEY FOREIGN KEY (decided_by_user_id) REFERENCES app_user(id)
fk_match_edit_proposed_by_user_id FOREIGN KEY FOREIGN KEY (proposed_by_user_id) REFERENCES app_user(id)
fk_match_edit_new_playset_id FOREIGN KEY FOREIGN KEY (new_playset_id) REFERENCES playset(id)
fk_match_edit_match_id FOREIGN KEY FOREIGN KEY (match_id) REFERENCES match(id)
match_edit_pkey PRIMARY KEY PRIMARY KEY (id)
uq_match_edit_public_id UNIQUE UNIQUE (public_id)
Name Definition
match_edit_pkey CREATE UNIQUE INDEX match_edit_pkey ON public.match_edit USING btree (id)
uq_match_edit_public_id CREATE UNIQUE INDEX uq_match_edit_public_id ON public.match_edit USING btree (public_id)
ix_match_edit_match_id CREATE INDEX ix_match_edit_match_id ON public.match_edit USING btree (match_id)
ix_match_edit_proposed_by_user_id CREATE INDEX ix_match_edit_proposed_by_user_id ON public.match_edit USING btree (proposed_by_user_id)
ix_match_edit_new_playset_id CREATE INDEX ix_match_edit_new_playset_id ON public.match_edit USING btree (new_playset_id)
ix_match_edit_decided_by_user_id CREATE INDEX ix_match_edit_decided_by_user_id ON public.match_edit USING btree (decided_by_user_id)

ER diagram


Generated by tbls