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
| Column | Type | Null | Default | Keys |
|---|---|---|---|---|
| id | uuid | no | gen_random_uuid() | PK |
| profile_id | uuid | no | — | |
| election_id | uuid | yes | — | |
| moderator_dancer_id | uuid | yes | — | |
| guidelines | text | no | — | |
| term_start | date | yes | — | |
| term_end | date | yes | — | |
| created_at | timestamp | yes | 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
- (profile_id)guideline_versions_profile_idx
Foreign keys
- profile_id → profiles.id on delete no action
- election_id → moderator_elections.id on delete no action
- moderator_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).
tRPC procedures
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.