Skip to content
Profiles & cities

follows

Follows — unified follow graph (ADR-004, Step 15). A dancer follows either a professional profile (venue/artist/organizer) OR another dancer. Exactly one of profile_id / target_dancer_id is set per row. Renamed from `artist_follows` (migration 0044). Mutual dancer→dancer follows = friends.

Columns

ColumnTypeNullDefaultKeys
iduuid nogen_random_uuid()
PK
dancer_iduuid no—
profile_iduuid yes—
target_dancer_iduuid yes—
created_attimestamp yesnow()

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

Keys, constraints & indexes

Unique

  • (dancer_id, profile_id) follows_dancer_profile
  • (dancer_id, target_dancer_id) follows_dancer_dancer

Indexes

  • (profile_id)
    follows_profile_idx
  • (target_dancer_id)
    follows_target_dancer_idx

Foreign keys

  • dancer_id → dancers.id
    on delete no action
  • profile_id → profiles.id
    on delete no action
  • target_dancer_id → dancers.id
    on delete no action

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
  }
  follows {
    uuid id PK
    uuid dancer_id FK
    uuid profile_id FK
    uuid target_dancer_id FK
  }
  profiles {
    uuid id PK
    text username UK
  }
  dancers ||--o{ follows : "dancer_id"
  profiles |o--o{ follows : "profile_id"
  dancers |o--o{ follows : "target_dancer_id"

Defined at server/database/schema.ts:973 as follows.