|
Download docs/DATAMODEL.md from HonzaH/Letschat: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/HonzaH/Letschat/resolve/main/docs/DATAMODEL.md
- Command line
-
hf download hf://spaces/HonzaH/Letschat/docs/DATAMODEL.md
-
curl -L -o DATAMODEL.md https://huggingface.co/spaces/HonzaH/Letschat/resolve/main/docs/DATAMODEL.md
1.29 kB
Data Model
This document describes the canonical data model used by the application.
Tables:
users
- id (UUID) primary key; in Supabase production this maps to auth.users.id
- email, token, status, fname, sname, nickname, birth_date, photo_url, lang
- timestamps: created_at, updated_at
rooms
- id (UUID) PK
- name, description
- status (soft delete), date_created, date_last_message, updated_at
codes
- id (UUID) PK
- code (5 chars, unique), linked_to (self FK), used, user_id (FK users), room_id (FK rooms)
- pin_hash, session_hash, date_first, date_last, used_count, created_at
room_messages
- id (UUID) PK
- room_id (FK rooms), code_id (FK codes), user_id (FK users)
- content, image_url, created_at
logs
- id (UUID) PK
- created_at, lang, ip, user_agent, module, operation, data (JSONB), error, level
Design notes:
- Codes are the primary access mechanism to rooms; a pair of codes is created (primary/secondary) and linked via linked_to for recovery/transfer flows.
- Users link codes (user_id) when they claim/transfer a code.
- Rooms are created and codes updated with room_id; messages reference room_id + code_id for provenance.
- Local development uses
src/db/localSQLcreate.sql; production usesrc/db/supabaseSQLcreate.sql.