Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
comms_db_client
What it is
Part of Chat's shared infrastructure: the query layer for channel messages, participants, mentions, and activity — the shared tables behind channel/document conversations.
Start here
src/lib.rs: module list — one module per table area (messages,channels,participants,entity_mentions,activity).src/model.rs: the shared row types (Message, etc.) returned by queries.src/messages/create_message.rs: a representativesqlx::query!call site.
Scope
- Owns:
sqlx::query!call sites overcomms_messagesand related tables. - Not here: the table schema itself, or any other MacroDB table → both live in
crates/macro_db_client/migrations; comms_db_client only queries them. - Not here: comms domain logic, authorization, or HTTP — those live in the callers listed below, not a dedicated comms service.
Boundaries
- Depends on:
channels(message event types),model(shared models). - Used by:
documents,search_service, and services that read/write channel messages (document_storage_service,authentication_service,search_processing_service), plustooling/seed_cli.
Recipes
- Add a query against an existing table: the matching
src/<area>/<verb>.rsfile → its siblingtest.rs→nix develop --command just prepare_dbfrom the repository root if.sqlxcache metadata is missing. - Add a new table area: new
src/<area>.rsmodule →pub mod <area>;insrc/lib.rs→ add the corresponding migration incrates/macro_db_client/migrationsfirst (schema lives there, not here).
Checks
cargo test -p comms_db_client(SQLX_OFFLINEunset; requires local MacroDB —just run_dbs -dthensqlx database setup, perREADME.md).
Gotchas
- This crate has no
migrations/of its own —comms_messagesand related tables are defined incrates/macro_db_client/migrations; keep query columns in sync with that schema, not the other way around.
Related
- Rules:
.agents/rules/rust/db.md· Docs:docs/development/database.md