Skip to content
Venue booking & governance

guideline_versions

Per-term guideline versions (G804): on close, the winner's guidelines become the space's active ruleset; every term is preserved so governance history is auditable across elections.

Columns

ColumnTypeNullDefaultKeys
iduuid nogen_random_uuid()
PK
profile_iduuid no—
election_iduuid yes—
moderator_dancer_iduuid yes—
guidelinestext no—
term_startdate yes—
term_enddate 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

None besides the primary key.

Indexes

  • (profile_id)
    guideline_versions_profile_idx

Foreign keys

Used by

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

REST & webhooks

  • 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
  }
  guideline_versions {
    uuid id PK
    uuid profile_id FK
    uuid election_id FK
    uuid moderator_dancer_id FK
  }
  moderator_elections {
    uuid id PK
    uuid profile_id FK
  }
  profiles {
    uuid id PK
    text username UK
  }
  profiles ||--o{ guideline_versions : "profile_id"
  moderator_elections |o--o{ guideline_versions : "election_id"
  dancers |o--o{ guideline_versions : "moderator_dancer_id"
  profiles ||--o{ moderator_elections : "profile_id"

Defined at server/database/schema.ts:657 as guidelineVersions.