chore:add cassandra message schema documentation#22
Conversation
This document outlines the Cassandra message data model, including user-defined types (UDTs) for participants, cards, card actions, and files, as well as the messages_by_room table schema.
Added definitions for thread_messages_by_room and pinned_messages_by_room tables.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds a new documentation page that defines a Cassandra CQL message data model: four UDTs ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/cassandra_message_model.md`:
- Line 2: Update the description sentence in the document fragment "Description:
This schema is for message related operation in Cassandra, include query,
upsert..." to correct grammar and hyphenation by changing it to something like:
"Description: This schema is for message-related operations in Cassandra,
including queries and upserts." Locate the exact text in the
docs/cassandra_message_model.md content and replace the original phrase with the
revised sentence.
- Around line 44-124: The docs currently describe
messages_by_room/thread_messages_by_room/pinned_messages_by_room schemas which
do not match the runtime tables and columns used in code (e.g., messages with
room_id, created_at, id, user_id, content referenced in
history-service/store_real.go, message-worker/store_mongo.go,
history-service/integration_test.go, pkg/model/message.go); update docs to
include a clear "Compatibility and Migrations" section that: states whether the
documented tables are future-state or current production, lists the actual
current production schema (table name messages and its columns), provides
explicit migration steps (DDL changes, data backfill strategy, and any
dual-write or read-cutover plan), and documents read/write cutover expectations
and impacted services (reference the functions/files above and the table names
messages_by_room/thread_messages_by_room/pinned_messages_by_room) so
implementers are not misled.
- Line 53: The mentions field is incorrectly using SET<"Participants"> and must
reference the singular UDT "Participant" and wrap UDT elements in FROZEN; update
every mentions declaration to use SET<FROZEN<"Participant">> (matching the
pattern used by reactions, e.g., MAP<TEXT,FROZEN<SET<FROZEN<"Participant">>>>),
ensuring all three table definitions that currently reference "Participants" are
changed to SET<FROZEN<"Participant">>.
- Line 21: The CREATE TYPE UDT definitions for Card and File contain trailing
commas before the closing ");" which is invalid CQL; edit the Card and File UDT
declarations to remove the trailing comma after the last field so the field
lists end with the final field then the closing ");" (i.e., locate the CREATE
TYPE Card and CREATE TYPE File blocks and delete the comma that appears
immediately before the closing parenthesis/semicolon).
- Line 68: Replace the misspelled CQL keyword "CLUSTRING" with the correct
"CLUSTERING" in the schema CQL statements (the lines containing the WITH ...
ORDER BY (createAt DESC, messageId DESC) clauses); update all occurrences of the
token "CLUSTRING" (appearing alongside the ORDER BY on lines noted in the
review) to "CLUSTERING" so the CQL schema is valid and executable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: dc7024ec-daad-4a80-b92e-ecfe1920cbac
📒 Files selected for processing (1)
docs/cassandra_message_model.md
Updated field names in Cassandra message model for consistency and clarity.
|
@coderabbitai help |
ChatThere are 3 ways to chat with CodeRabbit:
CodeRabbit commands
Other keywords and placeholders
CodeRabbit configuration file (
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
docs/cassandra_message_model.md (2)
44-126:⚠️ Potential issue | 🟠 MajorClarify whether this is future-state schema and add migration/cutover notes.
This schema is much broader than the current runtime message model (
pkg/model/message.go, Lines 5-11), so readers can easily assume it is already active. Please add a Compatibility and Migration section covering current production shape, future-state intent, and read/write cutover expectations.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/cassandra_message_model.md` around lines 44 - 126, Add a "Compatibility and Migration" section to this document that explicitly states these tables (messages_by_room, thread_messages_by_room, pinned_messages_by_room) represent a future-state schema, contrasts it with the current production message model (referencing pkg/model/message.go), and provides concrete migration/cutover guidance: list current production column set, mapping of new columns/types to current fields, steps for dual-write or backfill strategy, read/write cutover order, and any downtime/compatibility notes so readers understand rollout expectations.
2-2:⚠️ Potential issue | 🟡 MinorPolish the opening description sentence for grammar and clarity.
Line 2 still reads awkwardly (“operation”, “include query, upsert...”). Please rewrite to a concise, grammatical sentence so this doc is unambiguous.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/cassandra_message_model.md` at line 2, The opening description sentence labeled "Description:" is awkward; replace it with a concise grammatical sentence such as: "This schema defines message-related operations in Cassandra, including queries and upserts." Update the "Description" line so it clearly states the purpose (message-related operations) and lists examples using proper plural nouns ("queries" and "upserts") to remove ambiguity.
🧹 Nitpick comments (1)
docs/cassandra_message_model.md (1)
67-67: Use a consistent timestamp field name across tables.Line 67 uses
update_atwhile the other tables useupdated_at(Lines 96 and 122). Prefer one canonical name to avoid downstream mapping mistakes.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/cassandra_message_model.md` at line 67, The schema uses a mismatched timestamp field name: change the column named update_at to updated_at so it matches the other tables (references to update_at should be renamed to updated_at); update any related schema definitions, CQL queries, data mappers, serializers/deserializers, and tests that reference update_at to use updated_at (look for the symbol update_at and replace with updated_at, and verify code that expects updated_at like in other tables still works).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/cassandra_message_model.md`:
- Line 98: The CLUSTERING ORDER clause for table thread_messages_by_room uses
camelCase identifiers (threadRoomId, createAt, messageId) that don't match the
table's actual column names; update the clause to use the real column names
thread_room_id, created_at, and message_id so the CQL is valid (i.e., replace
threadRoomId→thread_room_id, createAt→created_at, messageId→message_id in the
CLUSTERING ORDER BY clause).
---
Duplicate comments:
In `@docs/cassandra_message_model.md`:
- Around line 44-126: Add a "Compatibility and Migration" section to this
document that explicitly states these tables (messages_by_room,
thread_messages_by_room, pinned_messages_by_room) represent a future-state
schema, contrasts it with the current production message model (referencing
pkg/model/message.go), and provides concrete migration/cutover guidance: list
current production column set, mapping of new columns/types to current fields,
steps for dual-write or backfill strategy, read/write cutover order, and any
downtime/compatibility notes so readers understand rollout expectations.
- Line 2: The opening description sentence labeled "Description:" is awkward;
replace it with a concise grammatical sentence such as: "This schema defines
message-related operations in Cassandra, including queries and upserts." Update
the "Description" line so it clearly states the purpose (message-related
operations) and lists examples using proper plural nouns ("queries" and
"upserts") to remove ambiguity.
---
Nitpick comments:
In `@docs/cassandra_message_model.md`:
- Line 67: The schema uses a mismatched timestamp field name: change the column
named update_at to updated_at so it matches the other tables (references to
update_at should be renamed to updated_at); update any related schema
definitions, CQL queries, data mappers, serializers/deserializers, and tests
that reference update_at to use updated_at (look for the symbol update_at and
replace with updated_at, and verify code that expects updated_at like in other
tables still works).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2ac94b37-2b45-4808-8f58-79c046d94504
📒 Files selected for processing (1)
docs/cassandra_message_model.md
ngangwar962
left a comment
There was a problem hiding this comment.
I think, required changes have been made. Good to go for initial version for cassandra tables
Updated 'Participant' type to change 'xxxx_name' to 'company_name'.
Removed duplicate 'tshow' field from message model.
add cassandra data model
Summary by CodeRabbit