Community engagement
tracked_link_actions
What a tracked link brought: a visit (per browser), a sign-up, a plan add or a ticket (per dancer). Each counts once per link. Last touch wins: the link in the visitor's `wd_via` cookie when they act.
Columns
| Column | Type | Null | Default | Keys |
|---|---|---|---|---|
| id | uuid | no | gen_random_uuid() | PK |
| link_id | uuid | no | — | |
| kind | text visitsignupplan_addticket | no | — | |
| dancer_id | uuid | yes | — | |
| visitor_id | text | yes | — | |
| ref | text | yes | — | |
| created_at | timestamp | no | now() |
Value lists come from .$type<'a' | 'b'>() in the schema — enforced in TypeScript only, not by the database.
Keys, constraints & indexes
Unique
None besides the primary key.
Indexes
- (link_id, kind, dancer_id)uniquetracked_link_actions_dancer_uidx · where "tracked_link_actions"."dancer_id" IS NOT NULL
- (link_id, kind, visitor_id)uniquetracked_link_actions_visitor_uidx · where "tracked_link_actions"."dancer_id" IS NULL AND "tracked_link_actions"."visitor_id" IS NOT NULL
- (link_id, kind)tracked_link_actions_link_idx
Foreign keys
- link_id → tracked_links.id on delete cascade
- dancer_id → dancers.id on delete cascade
Used by
Code that reads or writes this table, found by static analysis of the tRPC routers and API handlers (including helpers they call).
tRPC procedures
REST & webhooks
- POST /api/stripe/webhook
- ANY /mcp
- ANY /mcp/public
Relations
Rendering diagram…
Diagram source
erDiagram
dancers {
uuid id PK
text email UK
text neon_auth_id UK
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
}
tracked_links ||--o{ tracked_link_actions : "link_id"
dancers |o--o{ tracked_link_actions : "dancer_id"
dancers |o--o{ tracked_links : "created_by" Defined at server/database/schema.ts:1459 as trackedLinkActions.