Skip to content
Community engagement

tracked_links

A promoter's (or influencer's) personal link to one event: /events/<slug>?via=<code>. One per promoter page + event. The caption cached here is the kit caption written for this promoter (promo_kit), so it isn't rewritten on every call.

Columns

ColumnTypeNullDefaultKeys
iduuid nogen_random_uuid()
PK
codetext no—
unique
event_iduuid no—
profile_iduuid no—
created_byuuid yes—
captionjsonb yes—
created_attimestamp nonow()

Value lists come from .$type<'a' | 'b'>() in the schema — enforced in TypeScript only, not by the database.

Keys, constraints & indexes

Unique

  • (code) tracked_links_code_unique
  • (event_id, profile_id) tracked_links_event_profile

Indexes

  • (profile_id)
    tracked_links_profile_idx

Foreign keys

  • event_id → events.id
    on delete cascade
  • profile_id → profiles.id
    on delete cascade
  • created_by → dancers.id
    on delete set null

Referenced by

Used by

Code that reads or writes this table, found by static analysis of the tRPC routers and API handlers (including helpers they call).

Relations

Rendering diagram…

Diagram source
erDiagram
  dancers {
    uuid id PK
    text email UK
    text neon_auth_id UK
    text username UK
  }
  events {
    uuid id PK
    uuid host_profile_id FK
    uuid edited_by FK
  }
  profiles {
    uuid id PK
    text username UK
  }
  tracked_link_actions {
    uuid id PK
    uuid link_id FK
    uuid dancer_id FK
  }
  tracked_links {
    uuid id PK
    text code UK
    uuid event_id FK
    uuid profile_id FK
    uuid created_by FK
  }
  profiles |o--o{ events : "host_profile_id"
  dancers |o--o{ events : "edited_by"
  tracked_links ||--o{ tracked_link_actions : "link_id"
  dancers |o--o{ tracked_link_actions : "dancer_id"
  events ||--o{ tracked_links : "event_id"
  profiles ||--o{ tracked_links : "profile_id"
  dancers |o--o{ tracked_links : "created_by"

Defined at server/database/schema.ts:1443 as trackedLinks.