Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
# Storage migrations
Storage upgrades run at daemon startup before sessions open. Core and extension
migrations have separate owners. The
[extension runtime](../apps/albedo/src/albedo/runtime.gleam) exposes `migrate`
for extension data migrations.
## Generate typed queries
Put one query per file in `src/<package_namespace>/<owner>/sql/<function>.sql`
under its owning Gleam project. A directory becomes a Gleam module under
`src/<package_namespace>/generated/sql/`. Its module path mirrors the owner path
and ends in `_sql`. Use named SQLite parameters and check the generated
parameter and row types against the query, especially nullable joins and
expressions. Check in the generated modules. An extension keeps its SQL,
generated modules, schema, and migrations inside its own package and namespace.
Run the [generator](../test/marmot.py) from the repository root. It selects the
[pinned Marmot package](../tools/marmot/gleam.toml) for the current checkout.
| Change | Command |
| ---------------------------- | -------------------------------------------------------- |
| Edit queries in one package | `nix develop -c python3 test/marmot.py extensions/mail` |
| Regenerate the workspace | `nix develop -c python3 test/marmot.py` |
| Change the production schema | `nix develop -c python3 test/marmot.py --refresh-schema` |
| Check for drift | `nix develop -c python3 test/marmot.py --check` |
Normal generation uses the [schema snapshot](../tools/marmot/schema.sql), so it
can rebuild missing bindings before the daemon compiles. For a historical
fixture, `--schema PATH` reads an existing migrated database. Refresh and check
use
[production storage setup](../apps/albedo/test/albedo/manual/marmot_schema.gleam)
to apply core, kernel, and extension migrations. The private bootstrap VM
supplies current owner-local SQL for fixed script and column-addition bindings,
with includes expanded. Marmot’s `bootstrap-manifest`…