Skip to content

match

The aggregate root of gaming history. DRAFT while finalized_at is NULL: freely editable, and participants that are removed are deleted. FINALIZED afterwards: changed only through match edits. Deleting a match (only while DRAFT) soft-deletes it together with its participants. Invariants (application): the playset, if set, is for the same game; the expansions belong to the game.

Name Type Default Nullable Children Parents Comment
id bigint nextval(‘match_seq’::regclass) false public.match_expansion public.match_participant public.match_edit
public_id uuid gen_random_uuid() false
game_id bigint false public.game
playset_id bigint true public.playset
community_id bigint true public.community
recorder_user_id bigint false public.app_user
played_at timestamp with time zone false
edit_requests_enabled boolean true false
finalized_at timestamp with time zone true When the match was finalized; NULL while it is a DRAFT.
last_edited_at timestamp with time zone true
last_edited_by_user_id bigint true public.app_user
created_at timestamp with time zone now() false
updated_at timestamp with time zone true
deleted_at timestamp with time zone true
version bigint false
Name Type Definition
fk_match_last_edited_by_user_id FOREIGN KEY FOREIGN KEY (last_edited_by_user_id) REFERENCES app_user(id)
fk_match_recorder_user_id FOREIGN KEY FOREIGN KEY (recorder_user_id) REFERENCES app_user(id)
fk_match_game_id FOREIGN KEY FOREIGN KEY (game_id) REFERENCES game(id)
fk_match_playset_id FOREIGN KEY FOREIGN KEY (playset_id) REFERENCES playset(id)
fk_match_community_id FOREIGN KEY FOREIGN KEY (community_id) REFERENCES community(id)
match_pkey PRIMARY KEY PRIMARY KEY (id)
uq_match_public_id UNIQUE UNIQUE (public_id)
Name Definition
match_pkey CREATE UNIQUE INDEX match_pkey ON public.match USING btree (id)
uq_match_public_id CREATE UNIQUE INDEX uq_match_public_id ON public.match USING btree (public_id)
ix_match_game_id CREATE INDEX ix_match_game_id ON public.match USING btree (game_id)
ix_match_playset_id CREATE INDEX ix_match_playset_id ON public.match USING btree (playset_id)
ix_match_community_id CREATE INDEX ix_match_community_id ON public.match USING btree (community_id)
ix_match_recorder_user_id CREATE INDEX ix_match_recorder_user_id ON public.match USING btree (recorder_user_id)
ix_match_last_edited_by_user_id CREATE INDEX ix_match_last_edited_by_user_id ON public.match USING btree (last_edited_by_user_id)

ER diagram


Generated by tbls