docs: update README schema section to match sessions/clients tables #76

Merged
sneak merged 1 commits from docs/update-readme-schema-section into main 2026-03-18 03:38:37 +01:00
Collaborator

Updates the README Schema section and all related references throughout the document to accurately reflect the current database schema in 001_initial.sql.

Changes

Schema section:

  • Renamed users table → sessions with new columns: uuid, password_hash, signing_key, away_message
  • Added new clients table (multi-client support: uuid, session_id FK, token, created_at, last_seen)
  • Added topic_set_by and topic_set_at columns to channels table
  • Updated channel_members FK from user_idsession_id
  • Added params column to messages table
  • Updated client_queues FK from user_idclient_id
  • Added cascade delete annotations to FK descriptions
  • Added index documentation for sessions and clients tables

References throughout README:

  • Updated Queue Architecture diagram labels (user_id=Nclient_id=N)
  • Updated client_queues description text (user_idclient_id)
  • Updated In-Memory Broker description to use client_id terminology
  • Updated Multi-Client Model MVP note to reflect sessions/clients architecture
  • Updated long-polling implementation detail to reference per-client notification channels

closes #37

Updates the README Schema section and all related references throughout the document to accurately reflect the current database schema in `001_initial.sql`. ## Changes **Schema section:** - Renamed `users` table → `sessions` with new columns: `uuid`, `password_hash`, `signing_key`, `away_message` - Added new `clients` table (multi-client support: `uuid`, `session_id` FK, `token`, `created_at`, `last_seen`) - Added `topic_set_by` and `topic_set_at` columns to `channels` table - Updated `channel_members` FK from `user_id` → `session_id` - Added `params` column to `messages` table - Updated `client_queues` FK from `user_id` → `client_id` - Added cascade delete annotations to FK descriptions - Added index documentation for `sessions` and `clients` tables **References throughout README:** - Updated Queue Architecture diagram labels (`user_id=N` → `client_id=N`) - Updated `client_queues` description text (`user_id` → `client_id`) - Updated In-Memory Broker description to use `client_id` terminology - Updated Multi-Client Model MVP note to reflect sessions/clients architecture - Updated long-polling implementation detail to reference per-client notification channels closes #37
clawbot added 1 commit 2026-03-17 10:17:48 +01:00
docs: update README schema section to match actual database schema
All checks were successful
check / check (push) Successful in 1m11s
bd4326ad6f
Update the Schema section and related references throughout README.md to
accurately reflect the current 001_initial.sql migration:

- Rename 'users' table to 'sessions' with new columns: uuid, password_hash,
  signing_key, away_message
- Add new 'clients' table (uuid, session_id FK, token, created_at, last_seen)
- Add topic_set_by and topic_set_at columns to 'channels' table
- Update channel_members FK from user_id to session_id
- Add params column to messages table
- Update client_queues FK from user_id to client_id
- Update Queue Architecture diagram labels and surrounding text
- Update In-Memory Broker description to use client_id terminology
- Update Multi-Client Model MVP note to reflect sessions/clients split
clawbot added the needs-review label 2026-03-17 10:18:23 +01:00
clawbot reviewed 2026-03-17 10:32:02 +01:00
clawbot left a comment
Author
Collaborator

Review: PR #76 — docs: update README schema section

1. Policy Compliance

  • Docs-only change: Only README.md modified
  • Markdown formatting / 80-column wrap: One new table row is 81 chars (topic_set_by row). Table rows cannot be wrapped and the existing README already has 107 lines exceeding 80 chars on main. Not a violation — table markup is exempt from prose wrapping.
  • No code changes, no new dependencies:
  • PR title format: (docs: update README schema section to match sessions/clients tables)
  • Closes clause: (closes #37)

2. Schema Accuracy — Table-by-Table Verification Against internal/db/schema/001_initial.sql

sessions table

  • All 8 columns match SQL: id, uuid, nick, password_hash, signing_key, away_message, created_at, last_seen
  • Types correct (INTEGER, TEXT, DATETIME)
  • Index on (uuid) documented — matches idx_sessions_uuid

clients table

  • All 6 columns match SQL: id, uuid, session_id, token, created_at, last_seen
  • FK session_id → sessions.id ON DELETE CASCADE documented
  • Indexes on (token) and (session_id) documented — matches idx_clients_token and idx_clients_session

channels table

  • All 7 columns match SQL: id, name, topic, topic_set_by, topic_set_at, created_at, updated_at
  • New columns topic_set_by and topic_set_at correctly added

channel_members table

  • All 4 columns match SQL: id, channel_id, session_id, joined_at
  • FKs to channels.id and sessions.id both with cascade delete documented
  • Unique constraint on (channel_id, session_id) documented

messages table

  • All 9 columns match SQL: id, uuid, command, msg_from, msg_to, params, body, meta, created_at
  • New params column correctly added
  • Indexes on (msg_to, id) and (created_at) documented

client_queues table

  • All 4 columns match SQL: id, client_id, message_id, created_at
  • FKs to clients.id and messages.id both with cascade delete documented
  • Unique constraint on (client_id, message_id) documented
  • Index on (client_id, id) documented

3. Reference Updates Throughout README

  • Queue Architecture diagram: user_id=Nclient_id=N
  • client_queues description: (user_id, message_id)(client_id, message_id)
  • In-Memory Broker: user_id → []chan struct{}client_id → []chan struct{}
  • Broker method: Notify(userID)Notify(clientID)
  • Long-polling detail: per-user → per-client notification channels
  • Multi-Client Model MVP note: updated to reflect sessions/clients architecture

4. Build Result

docker build . → SUCCESS
make check (via Dockerfile) → all tests PASS, lint clean, fmt clean

5. Verdict

PASS

Every column, type, constraint, FK, and index in the README schema section matches internal/db/schema/001_initial.sql exactly. All textual references throughout the document have been correctly updated from the old user/token model to the new sessions/clients model. Build passes. Clean docs-only PR that accurately closes #37.

## Review: PR #76 — docs: update README schema section ### 1. Policy Compliance - **Docs-only change**: ✅ Only `README.md` modified - **Markdown formatting / 80-column wrap**: One new table row is 81 chars (`topic_set_by` row). Table rows cannot be wrapped and the existing README already has 107 lines exceeding 80 chars on `main`. Not a violation — table markup is exempt from prose wrapping. - **No code changes, no new dependencies**: ✅ - **PR title format**: ✅ (`docs: update README schema section to match sessions/clients tables`) - **Closes clause**: ✅ (`closes #37`) ### 2. Schema Accuracy — Table-by-Table Verification Against `internal/db/schema/001_initial.sql` #### `sessions` table - ✅ All 8 columns match SQL: `id`, `uuid`, `nick`, `password_hash`, `signing_key`, `away_message`, `created_at`, `last_seen` - ✅ Types correct (INTEGER, TEXT, DATETIME) - ✅ Index on `(uuid)` documented — matches `idx_sessions_uuid` #### `clients` table - ✅ All 6 columns match SQL: `id`, `uuid`, `session_id`, `token`, `created_at`, `last_seen` - ✅ FK `session_id → sessions.id ON DELETE CASCADE` documented - ✅ Indexes on `(token)` and `(session_id)` documented — matches `idx_clients_token` and `idx_clients_session` #### `channels` table - ✅ All 7 columns match SQL: `id`, `name`, `topic`, `topic_set_by`, `topic_set_at`, `created_at`, `updated_at` - ✅ New columns `topic_set_by` and `topic_set_at` correctly added #### `channel_members` table - ✅ All 4 columns match SQL: `id`, `channel_id`, `session_id`, `joined_at` - ✅ FKs to `channels.id` and `sessions.id` both with cascade delete documented - ✅ Unique constraint on `(channel_id, session_id)` documented #### `messages` table - ✅ All 9 columns match SQL: `id`, `uuid`, `command`, `msg_from`, `msg_to`, `params`, `body`, `meta`, `created_at` - ✅ New `params` column correctly added - ✅ Indexes on `(msg_to, id)` and `(created_at)` documented #### `client_queues` table - ✅ All 4 columns match SQL: `id`, `client_id`, `message_id`, `created_at` - ✅ FKs to `clients.id` and `messages.id` both with cascade delete documented - ✅ Unique constraint on `(client_id, message_id)` documented - ✅ Index on `(client_id, id)` documented ### 3. Reference Updates Throughout README - ✅ Queue Architecture diagram: `user_id=N` → `client_id=N` - ✅ `client_queues` description: `(user_id, message_id)` → `(client_id, message_id)` - ✅ In-Memory Broker: `user_id → []chan struct{}` → `client_id → []chan struct{}` - ✅ Broker method: `Notify(userID)` → `Notify(clientID)` - ✅ Long-polling detail: per-user → per-client notification channels - ✅ Multi-Client Model MVP note: updated to reflect sessions/clients architecture ### 4. Build Result ``` docker build . → SUCCESS make check (via Dockerfile) → all tests PASS, lint clean, fmt clean ``` ### 5. Verdict **PASS** ✅ Every column, type, constraint, FK, and index in the README schema section matches `internal/db/schema/001_initial.sql` exactly. All textual references throughout the document have been correctly updated from the old user/token model to the new sessions/clients model. Build passes. Clean docs-only PR that accurately closes [#37](https://git.eeqj.de/sneak/chat/issues/37).
clawbot added merge-ready and removed needs-review labels 2026-03-17 10:32:25 +01:00
sneak was assigned by clawbot 2026-03-17 10:32:26 +01:00
Owner

fix conflicts pls

fix conflicts pls
sneak removed their assignment 2026-03-17 12:52:16 +01:00
clawbot was assigned by sneak 2026-03-17 12:52:16 +01:00
clawbot added needs-rework and removed merge-ready labels 2026-03-17 12:53:38 +01:00
clawbot force-pushed docs/update-readme-schema-section from bd4326ad6f to f2af55e4a5 2026-03-17 12:57:14 +01:00 Compare
Author
Collaborator

Rebased onto main, resolving README.md conflicts from PR #77 (auth docs) and PR #80 (healthcheck docs).

Conflict 1 (multi-client note): Kept main's updated text from #77 describing POST /api/v1/login multi-client support, replacing the old "Current MVP note".

Conflict 2 (schema section): Merged both sides — kept main's detailed column descriptions (bcrypt hash, SHA-256 hash) from #77, added this PR's index documentation and consistent table formatting.

make fmt | docker build . (all tests pass)

Rebased onto main, resolving README.md conflicts from [PR #77](https://git.eeqj.de/sneak/chat/pulls/77) (auth docs) and [PR #80](https://git.eeqj.de/sneak/chat/pulls/80) (healthcheck docs). **Conflict 1** (multi-client note): Kept main's updated text from #77 describing `POST /api/v1/login` multi-client support, replacing the old "Current MVP note". **Conflict 2** (schema section): Merged both sides — kept main's detailed column descriptions (bcrypt hash, SHA-256 hash) from #77, added this PR's index documentation and consistent table formatting. `make fmt` ✅ | `docker build .` ✅ (all tests pass)
clawbot added needs-review and removed needs-rework labels 2026-03-17 12:57:57 +01:00
clawbot reviewed 2026-03-17 13:01:53 +01:00
clawbot left a comment
Author
Collaborator

Review (post-rework): PR #76 — docs: update README schema section

Context

Post-rework review after rebase to resolve conflicts from PR #77 (auth docs) and PR #80 (healthcheck docs).

1. Schema Accuracy — Column-by-Column Against 001_initial.sql

sessions (8 columns)

All columns match: id, uuid, nick, password_hash, signing_key, away_message, created_at, last_seen
Types correct. Index on (uuid) documented — matches idx_sessions_uuid.

clients (6 columns)

All columns match: id, uuid, session_id, token, created_at, last_seen
FK session_id → sessions.id ON DELETE CASCADE documented.
Indexes on (token) and (session_id) documented — matches idx_clients_token and idx_clients_session.

channels (7 columns)

All columns match: id, name, topic, topic_set_by, topic_set_at, created_at, updated_at

channel_members (4 columns)

All columns match: id, channel_id, session_id, joined_at
Both FKs with cascade delete documented. Unique constraint on (channel_id, session_id) documented.

messages (9 columns)

All columns match including params. Indexes on (msg_to, id) and (created_at) documented.

client_queues (4 columns)

All columns match: id, client_id, message_id, created_at
Both FKs with cascade delete. Unique constraint on (client_id, message_id). Index on (client_id, id).

2. Conflict Resolution Verification

Auth docs from PR #77 fully intact — POST /api/v1/login, multi-client model, password/bcrypt descriptions all present and identical to main.
Healthcheck docs from PR #80 fully intact — GET /.well-known/healthcheck.json endpoint, healthcheck.go, healthcheck/ directory all present.
No content lost or corrupted from either merged PR.

3. Reference Updates

Queue architecture diagram: user_id=Nclient_id=N
client_queues description: (user_id, message_id)(client_id, message_id)
In-memory broker: user_id → []chan struct{}client_id → []chan struct{}
Broker method: Notify(userID)Notify(clientID)
Long-polling: per-user → per-client notification channels

4. Build

docker build . → SUCCESS
make check (via Dockerfile) → all tests PASS, lint clean, fmt clean

5. Policy Compliance

Docs-only change (README.md only)
PR title format correct
closes #37 present

Verdict

PASS

Rebase cleanly preserved all schema documentation. All 6 tables match 001_initial.sql column-by-column. Content from PR #77 and PR #80 is intact. Build passes.

## Review (post-rework): PR #76 — docs: update README schema section ### Context Post-rework review after rebase to resolve conflicts from [PR #77](https://git.eeqj.de/sneak/chat/pulls/77) (auth docs) and [PR #80](https://git.eeqj.de/sneak/chat/pulls/80) (healthcheck docs). ### 1. Schema Accuracy — Column-by-Column Against `001_initial.sql` #### `sessions` (8 columns) ✅ All columns match: `id`, `uuid`, `nick`, `password_hash`, `signing_key`, `away_message`, `created_at`, `last_seen` ✅ Types correct. Index on `(uuid)` documented — matches `idx_sessions_uuid`. #### `clients` (6 columns) ✅ All columns match: `id`, `uuid`, `session_id`, `token`, `created_at`, `last_seen` ✅ FK `session_id → sessions.id ON DELETE CASCADE` documented. ✅ Indexes on `(token)` and `(session_id)` documented — matches `idx_clients_token` and `idx_clients_session`. #### `channels` (7 columns) ✅ All columns match: `id`, `name`, `topic`, `topic_set_by`, `topic_set_at`, `created_at`, `updated_at` #### `channel_members` (4 columns) ✅ All columns match: `id`, `channel_id`, `session_id`, `joined_at` ✅ Both FKs with cascade delete documented. Unique constraint on `(channel_id, session_id)` documented. #### `messages` (9 columns) ✅ All columns match including `params`. Indexes on `(msg_to, id)` and `(created_at)` documented. #### `client_queues` (4 columns) ✅ All columns match: `id`, `client_id`, `message_id`, `created_at` ✅ Both FKs with cascade delete. Unique constraint on `(client_id, message_id)`. Index on `(client_id, id)`. ### 2. Conflict Resolution Verification ✅ Auth docs from [PR #77](https://git.eeqj.de/sneak/chat/pulls/77) fully intact — `POST /api/v1/login`, multi-client model, password/bcrypt descriptions all present and identical to main. ✅ Healthcheck docs from [PR #80](https://git.eeqj.de/sneak/chat/pulls/80) fully intact — `GET /.well-known/healthcheck.json` endpoint, `healthcheck.go`, `healthcheck/` directory all present. ✅ No content lost or corrupted from either merged PR. ### 3. Reference Updates ✅ Queue architecture diagram: `user_id=N` → `client_id=N` ✅ `client_queues` description: `(user_id, message_id)` → `(client_id, message_id)` ✅ In-memory broker: `user_id → []chan struct{}` → `client_id → []chan struct{}` ✅ Broker method: `Notify(userID)` → `Notify(clientID)` ✅ Long-polling: per-user → per-client notification channels ### 4. Build ``` docker build . → SUCCESS make check (via Dockerfile) → all tests PASS, lint clean, fmt clean ``` ### 5. Policy Compliance ✅ Docs-only change (README.md only) ✅ PR title format correct ✅ `closes #37` present ### Verdict **PASS** ✅ Rebase cleanly preserved all schema documentation. All 6 tables match `001_initial.sql` column-by-column. Content from [PR #77](https://git.eeqj.de/sneak/chat/pulls/77) and [PR #80](https://git.eeqj.de/sneak/chat/pulls/80) is intact. Build passes.
clawbot added merge-ready and removed needs-review labels 2026-03-17 13:05:27 +01:00
clawbot removed their assignment 2026-03-17 13:05:27 +01:00
sneak was assigned by clawbot 2026-03-17 13:05:27 +01:00
sneak merged commit efbd8fe9ff into main 2026-03-18 03:38:37 +01:00
sneak deleted branch docs/update-readme-schema-section 2026-03-18 03:38:37 +01:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/chat#76