Dashboard › opencode › Distillation
6373be6b-edd5-461f-806a-42d6fa72ebaa["lore_tm_v1_QcHonR_PUw4mQ_A9TRLTEfyfyqYE4r_vOV05hzFo4N8"]
Date: Sep 15, 2026
/home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:150-156 finishes the session_context_epoch table definition: session_id text PRIMARY KEY, baseline text NOT NULL, snapshot text NOT NULL, baseline_seq integer NOT NULL, and foreign key fk_session_context_epoch_session_id_session_id_fk from session_id to session(id) with ON DELETE CASCADE./home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:157-168 creates session_execution with columns id text PRIMARY KEY, session_id text NOT NULL, owner_id text NOT NULL, nullable assistant_message_id text, phase text NOT NULL, time_created integer NOT NULL, and expires_at integer NOT NULL; fk_session_execution_session_id_session_id_fk references session(id) with ON DELETE CASCADE./home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:169-180 creates session_input with columns id text PRIMARY KEY, session_id text NOT NULL, prompt text NOT NULL, delivery text NOT NULL, admitted_seq integer NOT NULL, nullable promoted_seq integer, and time_created integer NOT NULL; fk_session_input_session_id_session_id_fk references session(id) with ON DELETE CASCADE./home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:181-192 creates session_message with columns id text PRIMARY KEY, session_id text NOT NULL, type text NOT NULL, seq integer NOT NULL, time_created integer NOT NULL, time_updated integer NOT NULL, and data text NOT NULL; fk_session_message_session_id_session_id_fk references session(id) with ON DELETE CASCADE./home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:193-205 creates session_recovery with session_id text NOT NULL, execution_id text NOT NULL, assistant_message_id text NOT NULL, continuation_message_id text NOT NULL, and time_created integer NOT NULL. Composite primary key session_recovery_pk covers (session_id, assistant_message_id); cascading foreign keys are session_id → session(id), assistant_message_id → session_message(id), and continuation_message_id → session_input(id)./home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:206-239 creates session with id text PRIMARY KEY; required fields project_id, slug, directory, title, and version; nullable workspace_id, parent_id, path, share_url, summary_additions, summary_deletions, summary_files, summary_diffs, metadata, revert, permission, agent, and model; counters cost real DEFAULT 0 NOT NULL, tokens_input integer DEFAULT 0 NOT NULL, tokens_output integer DEFAULT 0 NOT NULL, tokens_reasoning integer DEFAULT 0 NOT NULL, tokens_cache_read integer DEFAULT 0 NOT NULL, and tokens_cache_write integer DEFAULT 0 NOT NULL; required time_created and time_updated; nullable time_compacting and time_archived; and cascading foreign key fk_session_project_id_project_id_fk from project_id to project(id)./home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:240-252 creates todo with session_id text NOT NULL, content text NOT NULL, status text NOT NULL, priority text NOT NULL, position integer NOT NULL, time_created integer NOT NULL, and time_updated integer NOT NULL. Composite primary key todo_pk covers (session_id, position), and fk_todo_session_id_session_id_fk references session(id) with ON DELETE CASCADE./home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:253-263 creates session_share with session_id text PRIMARY KEY, id text NOT NULL, secret text NOT NULL, url text NOT NULL, time_created integer NOT NULL, and time_updated integer NOT NULL; fk_session_share_session_id_session_id_fk references session(id) with ON DELETE CASCADE./home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:264-273 creates indexes: unique event_aggregate_seq_idx on event(aggregate_id, seq); event_aggregate_type_seq_idx on event(aggregate_id, type, seq); unique permission_project_action_resource_idx on permission(project_id, action, resource); message_session_time_created_id_idx on message(session_id, time_created, id); part_message_id_id_idx on part(message_id, id); and part_session_idx on part(session_id)./home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:274-300 creates session-runtime indexes: unique session_execution_session_idx on session_execution(session_id); session_execution_owner_idx on session_execution(owner_id); session_input_session_pending_delivery_seq_idx on session_input(session_id, promoted_seq, delivery, admitted_seq); unique session_input_session_admitted_seq_idx on session_input(session_id, admitted_seq); unique session_input_session_promoted_seq_idx on session_input(session_id, promoted_seq); unique session_message_session_seq_idx on session_message(session_id, seq); session_message_session_type_seq_idx on session_message(session_id, type, seq); session_message_session_time_created_id_idx on session_message(session_id, time_created, id); session_message_time_created_idx on session_message(time_created); unique session_recovery_execution_idx on session_recovery(execution_id); and unique session_recovery_continuation_message_idx on session_recovery(continuation_message_id)./home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:301-304 creates session_project_idx on session(project_id), session_workspace_idx on session(workspace_id), session_parent_idx on session(parent_id), and todo_session_idx on todo(session_id)./home/byk/Code/opencode/packages/core/src/database/schema.gen.ts:305-307 closes the generated migration object with satisfies Omit<DatabaseMigration.Migration, "id">; the file contains 307 lines.