small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo robot-docs migrations.md

Storage migrations #

Storage upgrades run at daemon startup before sessions open. Core and extension migrations have separate owners. The extension runtime exposes migrate for extension data migrations.

Startup order #

server.start calls registry.prepare_storage before serving sessions. Core migrations.run runs image storage, transcript classification, session profiles, prompts, titles, and usage-hour upgrades in that order. Each result is checked, so an error stops the sequence.

Paperclips extension contributes schema migrations alongside its table initializer. Extension-owned schema changes belong with their owner. See extensions and paperclips.

Compatibility and interruption #

session_prompts.run moves older session prompt columns into the prompt table. transcript_classes.run handles older transcript rows. Inspect each migration's transaction and marker logic before changing its restart behavior. These upgrades do not all share one transaction.

Foreign-key indexes #

Make each foreign key's child columns the leading columns of an index. For a composite key, the index prefix must contain all child columns. An INTEGER PRIMARY KEY needs no separate index.

Deletion looks up referencing child rows. Without an index, that lookup scans the child table for each deleted parent row and can block the store writer. test_every_foreign_key_column_is_indexed checks this invariant across the schema. Preserve it when adding or changing extension tables as well as core tables.

Migration test inventory #

test/e2e/migrations_test.py exercises startup with older data. Keep an upgrade scenario while its old format remains supported. A fresh database does not exercise that path. The normal test gate is described in test execution.