Files
zeekayandGitHub ba76880a07 db: an embedder opens the stores (Seam) (#35)
Config.Seam and EmbedConfig.Seam hand the opening of each org's store, and
the system one, to the host. The host is given the namespace and an open
func that builds the store over the *sql.DB it made, so it can keep the
store as a file or as a schema on a server and key it itself; the module
is then given no master key.

The server store is the file's shape (TenantColumn "namespace"), so a
file's rows move to it as they are and a binary on the file and one on the
server read the same records.  A request with no namespace is scoped by
none, as in a file.  The standalone PostgresDB is unchanged: tenant_id and
its TenantID fallback.

Opening a server store does no DDL once _entities and its guard exist, so
a replica opening a tenant does not wait on the others' writers.  The guard
function carries the search_path it was made under, so a bulk copy into the
store from another path meets the same guard and finds secret_like.
GetMulti fills the slice the datastore layer sized, as SQLite does.

Testing: db/seam_test.go runs one exercise on a file and on PostgreSQL and
asserts shape, idempotent open and the guard from another path; each fails
with its fix removed.  go test ./db/ . passes on SQLite and with
COMMERCE_TEST_POSTGRES_DSN set.
Risk: the seam is opt-in; with no Seam nothing changes except the
nil-master-key switch in NewManager, which keeps its three outcomes.
Revert: git revert; no schema it created differs from what SQLiteDB and
PostgresDB already make.

Claude-Session: https://claude.ai/code/session_015XYKLnBbrbajqj1GpRydF8
2026-11-09 04:20:12 -08:00
..
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00