Turfi Platform Documentation
Official Turfi documentation portal for users, admins, and developers.
Documentation Search
Search only within Turfi documentation pages.
C
Competition Registrations
Competition registration registry contract, standalone grid behavior, and validation rules.
Entity: Competition Registrations
1. Overview
- Join table registering teams into competitions, with group and seeding metadata used by scheduling and standings logic.
- Belongs to a competition and team.
- Drives competition team lists, group assignments, and seed ordering.
- Visible at
/admin/data/registries/competition-registrations. - Primary operator surfaces are the standalone registry grid, the competition Teams tab, and the import route
/admin/imports/new?entity=team_competitions.
2. Database Schema
Columns
| column | type | nullable | default | notes | |
|---|---|---|---|---|---|
| competition_id | string | no | none | Relationship-bearing column. | |
| created_at | string \ | null | yes | null | Base table field. |
| group_name | string \ | null | yes | null | Base table field. |
| id | string | no | generated UUID default | Base table field. | |
| seed | number \ | null | yes | null | Base table field. |
| team_id | string | no | none | Relationship-bearing column. |
Foreign Keys
| column | references | table | on delete |
|---|---|---|---|
| competition_id | id | competitions | NO ACTION |
| team_id | id | teams | NO ACTION |
Indexes
No migration-defined indexes were discovered in the checked-in SQL history for this table.
Constraints
- Unique: none discovered in checked-in migrations.
- Check: none discovered in checked-in migrations.
Triggers
No migration-defined triggers were discovered in the checked-in SQL history for this table.
Views (if any)
| name | purpose |
|---|---|
| public.v_team_competitions | Admin registry read model for resolved competition-registration labels. |
| base-table fallback reads | Development fallback when the registry view is not yet deployed. |
3. Import Contract
Accepted Columns
competition_keycompetitioncompetition_idteam_keyteamteam_idgroup_nameseed
Resolution Rules
competition_keyandteam_keyresolve onkeyfirst.- Non-suffixed competition/team inputs resolve by
key, thenslug, thenname.
Required Fields
competition_idteam_id
Optional Fields
competition_keycompetitionteam_keyteamgroup_nameseed
Failure Rules
- Competition and team resolution fail hard because the join table is meaningless without both sides.
- Age-group and gender mismatch with the target competition fails validation in the admin workflow.
4. Frontend Registry Mapping
Grid Columns
| label | field | source |
|---|---|---|
| Competition | competition_name | competitions.name |
| Season | season_name | seasons.name |
| Organization | organization_name | organizations.name |
| Team | team_name | teams.name |
| Club | club_name | clubs.name |
| Team Key | team_key | teams.key |
| Group | group_name | team_competitions.group_name |
| Seed | seed | team_competitions.seed |
Filters
| filter | field | type |
|---|---|---|
| Organization | organization_id | entity |
| Season | season_id | entity |
| Competition | competition_id | entity |
| Club | club_id | entity |
| Team | team_id | entity |
Display Logic
- Competition team options display as
Team (Club) [key]in the editor. - Registry reads prefer
v_team_competitionsso the grid can show competition, season, organization, team, and club context from one source. - Registrations sort by group name, then seed, then creation time.
- Save-time validation enforces age-group and gender compatibility with the competition.
5. Lifecycle Rules
- Competition registrations should be edited or archived carefully because games and standings depend on them.
- Uniqueness of
(competition_id, team_id)is a core lifecycle invariant.