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
models_databases
What it is
Part of Macro Databases. The typed write vocabulary: ops, cell/column/view types, the cast rule, and fractional-index position keys — shared by the SQL engine (which also runs in the browser via wasm), the HTTP API, and the domain.
Start here
src/ops.rs:DatabaseOpand the row/column/view change/result types — the core vocabulary everything else is built from.src/cast.rs: the cell-value casting rule between column kinds.src/date_range.rs:DateRange, a date-range cell's value, its ISO interval parser and how it compares to a date (contains / before / after).src/views.rs+src/views/: view filter/sort evaluation (eval.rs), Kanban lane keys (lane_key.rs,lanes.rs).src/formula.rs: derived/formula column types.src/position.rs: fractional-index row/column ordering.src/ids.rs: all database id newtypes (DatabaseId,TableId,RowId, …).
Scope
- Owns: the write-op vocabulary, cell casting, view evaluation, and position
keys — kept wasm-safe (no
workspace-hackdependency; see.config/hakari.toml). - Not here: SQL execution or the domain port →
database_sql,databases_sql; Forms (a view of one table) →models_forms.
Boundaries
- Depends on:
fractional_index,macro_user_id,macro_uuid— noworkspace-hack, so new dependencies must stay wasm-compatible. - Used by:
crm,databases,database_sql,databases_sql,document_storage_service,forms,graphql_crm,models_forms.
Recipes
- Add a column kind:
src/ops.rs(ColumnKind,CellValue) →src/cast.rs(casting rules) →src/views/eval.rsif it affects filtering/sorting → consumers indatabase_sql/databases_sql. - Add a formula operator:
src/formula.rs→database_sql's formula evaluator.
Checks
cargo test -p models_databases(SQLX_OFFLINEunset).
Gotchas
- Stay wasm-safe: don't add a dependency that isn't already wasm-compatible,
and don't add
workspace-hack.
Related
- Skill:
database-core