diff --git a/apps/admin/src/types/database.types.ts b/apps/admin/src/types/database.types.ts
index 2f0112b..d45cb99 100644
--- a/apps/admin/src/types/database.types.ts
+++ b/apps/admin/src/types/database.types.ts
@@ -170,6 +170,7 @@ export type Database = {
colour: string
created_at: string
id: string
+ link: string | null
logo_path: string | null
name: string
}
@@ -178,6 +179,7 @@ export type Database = {
colour: string
created_at?: string
id?: string
+ link?: string | null
logo_path?: string | null
name: string
}
@@ -186,6 +188,7 @@ export type Database = {
colour?: string
created_at?: string
id?: string
+ link?: string | null
logo_path?: string | null
name?: string
}
@@ -580,6 +583,21 @@ export type Database = {
},
]
}
+ site_data_versions: {
+ Row: {
+ area: string
+ version: number
+ }
+ Insert: {
+ area: string
+ version?: number
+ }
+ Update: {
+ area?: string
+ version?: number
+ }
+ Relationships: []
+ }
team: {
Row: {
created_at: string
@@ -629,10 +647,7 @@ export type Database = {
Args: { for_guest: string; photo_ids: string[] }
Returns: undefined
}
- reorder_team_photos: {
- Args: { photo_ids: string[] }
- Returns: undefined
- }
+ reorder_team_photos: { Args: { photo_ids: string[] }; Returns: undefined }
}
Enums: {
[_ in never]: never
diff --git a/supabase/v2/README.md b/supabase/v2/README.md
index 00c6147..374a093 100644
--- a/supabase/v2/README.md
+++ b/supabase/v2/README.md
@@ -19,14 +19,14 @@ The current `events` table is one picture and a blurb. The redesign needs more:
| Slides, review packages and other files on an event | `event_documents` plus files in storage (all public) |
| Who's running an event, on or off the team | `event_hosts`, each a team member **or** a guest; `guests` for people outside LCS |
| Similar past events on an event page | `event_related`, hand-picked in the admin |
-| "Will it be streamed?" in the YouTube section, and the recording | `events.will_stream`, `events.stream_url` |
+| The stream and its recording in the YouTube section | `events.stream_url` |
| Meet the Team grouped by department | `team` as today |
Decided against: a `series` table. Category covers "what kind of event" and hand-picked related events cover
"see also", so series would overlap with both. Hack to the Future is an event with category `hackathon`; its
recap page stays separate and isn't in the database for now. YouTube videos come from the channel feed.
-## Diagram
+## Diagrams
```mermaid
erDiagram
@@ -34,11 +34,11 @@ erDiagram
events ||--o{ event_hosts : "hosted by"
events ||--o{ event_topics : "has topics"
events ||--o{ event_partners : "has partners"
- events ||--o{ photos : "has gallery photos"
- buildings ||--o{ events : "hosts"
- team |o--o{ event_hosts : "hosts as a member"
- guests |o--o{ event_hosts : "hosts as a guest"
- companies ||--o{ guests : "employs"
+ events o|--o{ photos : "groups photos"
+ buildings o|--o{ events : "is the place for"
+ team |o--o{ event_hosts : "is a team host"
+ guests |o--o{ event_hosts : "is a guest host"
+ companies o|--o{ guests : "employs"
companies ||--o{ event_partners : "partners"
guests ||--o{ photo_guests : "appears in"
photos ||--o{ photo_guests : "shows"
@@ -48,76 +48,100 @@ erDiagram
events {
uuid id PK
text title
- text description
+ text description "nullable"
date date
time start_time "null = TBD"
- time end_time
- text location
+ time end_time "nullable"
+ text location "nullable"
text category "review | social | career | workshop | hackathon | meet_the_pros"
- text stream_url
- text poster_path
- text format
- text building_code FK
- text room
- text slug
+ text stream_url "nullable"
timestamptz created_at
+ text poster_path "nullable; event-media path"
+ text slug UK "nullable"
+ text building_code FK "nullable"
+ text room "nullable"
+ text format "in_person | online"
+ text meeting_url "nullable"
+ text_array highlights "food | snacks | drinks | speaker_series"
+ text dress_code "nullable"
+ text primary_colour "nullable"
+ text secondary_colour "nullable"
}
buildings {
text code PK
text name
+ timestamptz created_at
}
photos {
uuid id PK
- uuid event_id FK
- text path "event-photos: file"
- boolean on_event_page
+ text path UK "event-photos path"
+ text alt "nullable"
+ uuid event_id FK "nullable"
+ boolean is_team_photo
int sort_order
+ timestamptz created_at
+ int width
+ int height
+ real focus_x "0..1"
+ real focus_y "0..1"
+ int team_sort_order
+ boolean on_event_page
}
photo_guests {
- uuid photo_id FK
- uuid guest_id FK
+ uuid photo_id PK, FK
+ uuid guest_id PK, FK
+ int sort_order
}
companies {
uuid id PK
- text name
- text logo_path
+ text name UK
+ text colour
+ text logo_path "nullable; company-logos path"
+ timestamptz created_at
+ text card_logo_path "nullable; company-logos path"
+ text link "nullable"
}
event_documents {
uuid id PK
uuid event_id FK
text title
- text path "event-media: event_id/docs/file"
+ text path UK "nullable; event-media path"
int sort_order
+ timestamptz created_at
+ text url "nullable"
+ text kind "practice_exam | slides | recording | navigator | form | website | other"
}
event_hosts {
uuid id PK
uuid event_id FK
- uuid team_id FK "set this or guest_id"
- uuid guest_id FK "set this or team_id"
+ uuid team_id FK, UK "nullable; exactly one person"
+ uuid guest_id FK, UK "nullable; exactly one person"
int sort_order
}
event_topics {
uuid id PK
uuid event_id FK
text text
- text icon
+ text icon "nullable"
int sort_order
}
event_partners {
- uuid event_id FK
- uuid company_id FK
+ uuid event_id PK, FK
+ uuid company_id PK, FK
int sort_order
}
guests {
uuid id PK
text name
- text title "role or company"
- text picture_path "guest-photos: guest_id/file"
- text link_url
+ text title "nullable"
+ text picture_path "nullable; guest-photos path"
+ text link_url "nullable"
+ timestamptz created_at
+ uuid company_id FK "nullable"
}
event_related {
- uuid event_id PK
- uuid related_id PK
+ uuid event_id PK, FK
+ uuid related_id PK, FK "must differ from event_id"
int sort_order
}
team {
@@ -129,10 +153,43 @@ erDiagram
text github_url
text linkedin_url
boolean is_public
+ timestamptz created_at
}
+ site_data_versions {
+ text area PK
+ bigint version
+ }
+```
+
+```mermaid
+flowchart LR
+ classDef v2 fill:#e7f5ef,stroke:#16794a,color:#113321
+ classDef legacy fill:#fff2dc,stroke:#a45c00,color:#512d00,stroke-dasharray: 5 5
+ classDef shared fill:#fff8d6,stroke:#8a6500,color:#4d3900,stroke-dasharray: 5 5
+
+ media["event-media
public · 20 MiB
JPEG, PNG, WebP, GIF, AVIF, PDF, PowerPoint"]
+ photos["event-photos
public · 20 MiB
JPEG, PNG, WebP, AVIF"]
+ guests["guest-photos
public · 5 MiB
JPEG, PNG, WebP, AVIF"]
+ logos["company-logos
public · 2 MiB
PNG, JPEG, WebP, AVIF"]
+ team["team-images
public · no limit
PNG, JPEG, WebP, GIF
shared v1 / v2"]
+ old["events-images
public · no limit
PNG, JPEG, WebP, GIF
v1 / old site"]
+
+ poster["v2.events.poster_path"] -->|"event_id/photos/uuid.ext"| media
+ document["v2.event_documents.path"] -->|"event_id/docs/uuid.ext"| media
+ photo["v2.photos.path"] -->|"uuid.ext (root)"| photos
+ guest_picture["v2.guests.picture_path"] -->|"uuid.ext (root)"| guests
+ logo["v2.companies.logo_path"] -->|"uuid.ext (root)"| logos
+ card_logo["v2.companies.card_logo_path"] -->|"uuid.ext (root)"| logos
+ team_picture["v2.team.picture_path"] -->|"uuid.ext (root)"| team
+ v1_events["public.events.picture_url"] -->|"legacy root objects"| old
+ v1_team["public.team.picture_url"] -->|"legacy root objects"| team
+
+ class media,photos,guests,logos v2
+ class old legacy
+ class team shared
```
-Update this diagram in any PR that changes the v2 schema.
+Built from the live database on 2026-11-30. Update both diagrams in any PR that changes the v2 schema or a bucket.
## How the pieces fit
@@ -154,25 +211,6 @@ Update this diagram in any PR that changes the v2 schema.
Anyone can read everything in v2 except unpublished team members. Only admins (`public.is_admin()`, the same
check the current admin uses) can insert, update or delete. Nobody can truncate through the API.
-## Storage
-
-```
-event-media/ public, 20 MB per file, images + PDF + PowerPoint
- /
- photos/.
- docs/.
-guest-photos/ public, 5 MB per file, images
- /.
-event-photos/ public, 20 MB per file, images: photos from the camera (v2.photos.path)
-company-logos/ public, 2 MB per file, images (no SVG): company logos (v2.companies.logo_path)
-team-images/ unchanged, still used by v2.team
-events-images/ unchanged, only the live site uses it
-```
-
-One folder per event keeps everything for an event together and easy to clean up. Upload with a random or
-timestamped name, not the original file name, so two `IMG_0001.jpg`s never overwrite each other. Admin-only
-write rules match `events-images` and `team-images`.
-
## Moving the data
| Today (`public`) | v2 |