StateStore dialects (SQLite vs Postgres)
Tyrum supports SQLite (default) and Postgres for the gateway StateStore. To keep the SQLite path lightweight while still using native Postgres types where they matter, the schemas intentionally diverge in a few places.
Intentional type divergences
This list is intentionally short. If you add a new divergence, add it here and centralize any dialect handling in packages/gateway/src/statestore/.
- IDs:
TEXT(SQLite) vsUUID(Postgres) - Booleans:
INTEGER(0/1) (SQLite) vsBOOLEAN(Postgres) - Timestamps:
TEXT+datetime('now')(SQLite) vsTIMESTAMPTZ+now()(Postgres) - Millisecond epochs / counters:
INTEGER(SQLite) vsBIGINT(Postgres)
Guidelines
- Prefer parameterized SQL and avoid branching on
db.kindin feature modules. - Centralize dialect differences in small helpers under
packages/gateway/src/statestore/. - When reading timestamps, normalize them (see
packages/gateway/src/utils/db-time.ts).
Helpers
packages/gateway/src/statestore/sql.tsexports:sqlBoolParam(db, value)for binding boolean-ish parameters (true/falsevs1/0)sqlActiveWhereClause(db)for building thewatchers.activepredicate without inline dialect conditionals