Skip to main content

10 — Tags

What it is: A lightweight, cross-entity labeling system. One tag can be applied to many different entity types — events, packs, tiers, packages, sections, price codes.


Tables

tbl_tags

FieldNotes
tagIdPK
tagNameunique across the system (case-sensitive)
tagHexoptional hex color (e.g. #FF5733) for badge UI

tbl_entity_tag_mapping

Generic junction table. One row = one tag applied to one entity.

FieldNotes
entityCodethe entity's identifier (eventCode, packId as text, tierId as text, etc.)
entityTypeEVENT, PACK, PACKAGE, PACK_TIER, SECTION_NAME, PRICE_CODE, SUITE, SUITE_TYPE
tagIdFK to tbl_tags

Composite PK: (entityCode, entityType, tagId) — prevents duplicate assignments.

⚠️ entityType is case-sensitive — store it UPPERCASE. Read-side filters match the literal value (e.g. etm."entityType" = 'EVENT'), but the admin write API doesn't enforce casing (free-form string), so a lowercase event saves fine yet silently never matches on read.


Entity type → entityCode format

entityTypeentityCode value
EVENTeventCode (string, used directly)
PACKpackId cast to text
PACKAGEpackageId cast to text
PACK_TIERtierId cast to text
SECTION_NAMEsection name string
PRICE_CODEprice code string
SUITEsuiteId cast to text
SUITE_TYPEsuiteTypeId cast to text

Key rules

  • Tags are included in the getCatalog API response for all tagged entities
  • A tag cannot be hard-deleted if it has active mappings (FK ON DELETE NO ACTION)
  • Tags are reusable — same tag can appear on events, packs, sections, etc.
  • Tags vs Categories: tags are informal/multi-entity; categories (in 09-event.md) are formal and event-only