Last deployment:

Turfi Platform Documentation

Official Turfi documentation portal for users, admins, and developers.

Back to support

Documentation Search

Search only within Turfi documentation pages.

C

Leagues

League registry contract.

Entity: Leagues

1. Overview

  • League registry linking governance organizations, lifecycle state, and lookup-backed competition context used by imports and admin tools.
  • Belongs to an organization.
  • May carry gender and league-type lookup assignments.
  • Provides an optional parent for competitions.
  • Visible at /admin/data/registries/leagues.

2. Database Schema

Columns

columntypenullabledefaultnotes
address_idstring \nullyesnullRelationship-bearing column.
created_atstring \nullyesnullBase table field.
emailstring \nullyesnullBase table field.
gender_idstring \nullyesnullRelationship-bearing column.
idstringnogenerated UUID defaultBase table field.
keystringnononeBase table field.
league_type_idstring \nullyesnullRelationship-bearing column.
namestringnononeBase table field.
normalized_namestring \nullyesnullBase table field.
organization_idstring \nullyesnullRelationship-bearing column.
phonestring \nullyesnullBase table field.
provincestring \nullyesnullBase table field.
slugstring \nullyesnullBase table field.
statusstringnodatabase default or generatedLifecycle field when present.
updated_atstring \nullyesnullBase table field.
websitestring \nullyesnullBase table field.

Foreign Keys

columnreferencestableon delete
address_ididaddressesNO ACTION
gender_ididgendersNO ACTION
league_type_ididleague_typesNO ACTION
organization_ididorganizationsNO 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)

namepurpose
v_leaguesCurated admin registry read model for leagues.

3. Import Contract

Accepted Columns

  • key
  • name
  • slug
  • status
  • organization_key
  • organization
  • organization_id
  • league_type_key
  • league_type
  • league_type_id
  • gender_key
  • gender
  • gender_id
  • address_line1
  • address_line2
  • city
  • province
  • postal_code
  • country
  • phone
  • email
  • website

Resolution Rules

  • organization_key, league_type_key, and gender_key resolve on the target table key column first.
  • Non-suffixed relationship fields resolve by key, then slug, then name.
  • Lookup-backed values are normalized to their lookup ids before writes when the CSV uses keys or labels.

Required Fields

  • name

Optional Fields

  • key
  • slug
  • status
  • organization_key
  • organization
  • organization_id
  • league_type_key
  • league_type
  • league_type_id
  • gender_key
  • gender
  • gender_id
  • address_line1
  • address_line2
  • city
  • province
  • postal_code
  • country
  • phone
  • email
  • website

Failure Rules

  • Missing name fails immediately.
  • Organization mismatches pause or fail depending on import execution context because leagues cannot safely persist with the wrong parent.
  • Lookup mismatches are expected to go through mismatch handling before database validation.

4. Frontend Registry Mapping

Grid Columns

labelfieldsource
Namenamev_leagues.name / leagues.name
League Typeleague_type_keyv_leagues.league_type / league_types
Gendergender_keyv_leagues.gender / genders
Addressaddressv_leagues.address / addresses
Citycityv_leagues.city / addresses.city
Provinceprovincev_leagues.province / addresses.province
Phonephoneleagues.phone
Emailemailleagues.email
Websitewebsiteleagues.website
Statusstatusleagues.status
Organizationorganization_nameorganizations.name

Filters

filterfieldtype
Searchname, normalized_name, organization_name, city, province, phone, email, websitetext substring
Organizationorganization_idselect
League Typeleague_type_idlookup select
Gendergender_idlookup select
Provinceprovincetext / distinct select
Statusstatusselect

Display Logic

  • League type and gender are rendered from lookup labels, not raw UUIDs.
  • Organization is displayed by resolved organization name.
  • Address attributes are flattened from the linked shared address relationship.

5. Lifecycle Rules

  • League lifecycle is status-driven when the base table exposes a status constraint.
  • Updates must preserve organization alignment because downstream competitions inherit league context.
  • Delete behavior should be treated as governed by dependent competition relationships even if not all deletes are UI-blocked.