Documentation
¶
Index ¶
- func MigrateAdditionalIndexes(db *sql.DB) error
- func MigrateAgentFields(db *sql.DB) error
- func MigrateAuthorColumns(db *sql.DB) error
- func MigrateBlockedIssuesCache(db *sql.DB) error
- func MigrateBranchStatesTable(db *sql.DB) error
- func MigrateChildCountersTable(db *sql.DB) error
- func MigrateCloseReasonColumn(db *sql.DB) error
- func MigrateClosedAtConstraint(db *sql.DB) error
- func MigrateClosedBySessionColumn(db *sql.DB) error
- func MigrateCompactedAtCommitColumn(db *sql.DB) error
- func MigrateCompactionColumns(db *sql.DB) error
- func MigrateCompactionConfig(db *sql.DB) error
- func MigrateCompositeIndexes(db *sql.DB) error
- func MigrateContentHashColumn(db *sql.DB) error
- func MigrateCreatedByColumn(db *sql.DB) error
- func MigrateCrystallizesColumn(db *sql.DB) error
- func MigrateDevlogBranchColumn(db *sql.DB) error
- func MigrateDevlogCascades(db *sql.DB) error
- func MigrateDevlogCommitSHA(db *sql.DB) error
- func MigrateDevlogEnrichmentStatus(db *sql.DB) error
- func MigrateDevlogFileHash(db *sql.DB) error
- func MigrateDevlogGhostColumn(db *sql.DB) error
- func MigrateDevlogMissingFlag(db *sql.DB) error
- func MigrateDevlogSchema(db *sql.DB) error
- func MigrateDirtyIssuesTable(db *sql.DB) error
- func MigrateDropEdgeColumns(db *sql.DB) error
- func MigrateDueDeferColumns(db *sql.DB) error
- func MigrateEdgeConsolidation(db *sql.DB) error
- func MigrateEdgeFields(db *sql.DB) error
- func MigrateEntityAliasRegistry(db *sql.DB) error
- func MigrateEntityDepsHardening(db *sql.DB) error
- func MigrateEntityPreferredName(db *sql.DB) error
- func MigrateEventFields(db *sql.DB) error
- func MigrateExportHashesTable(db *sql.DB) error
- func MigrateExternalRefColumn(db *sql.DB) (retErr error)
- func MigrateExternalRefUnique(db *sql.DB) error
- func MigrateExtractionEvolSchema(db *sql.DB) error
- func MigrateGateColumns(db *sql.DB) error
- func MigrateHookedStatus(db *sql.DB) error
- func MigrateIsTemplateColumn(db *sql.DB) error
- func MigrateMessagingFields(db *sql.DB) error
- func MigrateMolTypeColumn(db *sql.DB) error
- func MigrateOrphanDetection(db *sql.DB) error
- func MigrateOwnerColumn(db *sql.DB) error
- func MigratePinnedColumn(db *sql.DB) error
- func MigratePopulateFTS(db *sql.DB) error
- func MigrateQualityScoreColumn(db *sql.DB) error
- func MigrateRemoveDependsOnFK(db *sql.DB) error
- func MigrateRepoMtimesTable(db *sql.DB) error
- func MigrateSnapshotsTable(db *sql.DB) error
- func MigrateSourceRepoColumn(db *sql.DB) error
- func MigrateSourceSystemColumn(db *sql.DB) error
- func MigrateTombstoneClosedAt(db *sql.DB) error
- func MigrateTombstoneColumns(db *sql.DB) error
- func MigrateWorkTypeColumn(db *sql.DB) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MigrateAdditionalIndexes ¶
MigrateAdditionalIndexes adds performance optimization indexes identified during schema review.
Indexes added:
- idx_issues_updated_at: For GetStaleIssues date filtering
- idx_issues_status_priority: For common list query patterns
- idx_labels_label_issue: Covering index for label lookups
- idx_dependencies_issue_type: For blocked issues queries
- idx_events_issue_type: For close reason queries
func MigrateAgentFields ¶
MigrateAgentFields adds agent-specific fields to the issues table. These fields support the agent-as-bead pattern:
- hook_bead: current work attached to agent's hook (0..1 cardinality)
- role_bead: reference to role definition bead
- agent_state: agent-reported state (idle|running|stuck|stopped)
- last_activity: timestamp for timeout detection
- role_type: agent role (polecat|crew|witness|refinery|mayor|deacon)
- rig: rig name (empty for town-level agents)
func MigrateAuthorColumns ¶
func MigrateBlockedIssuesCache ¶
MigrateBlockedIssuesCache creates the blocked_issues_cache table for performance optimization This cache materializes the recursive CTE computation from GetReadyWork to avoid expensive recursive queries on every call
func MigrateCloseReasonColumn ¶
MigrateCloseReasonColumn adds the close_reason column to the issues table. This column stores the reason provided when closing an issue.
func MigrateClosedBySessionColumn ¶
MigrateClosedBySessionColumn adds the closed_by_session column to the issues table. This tracks which Claude Code session closed the issue, enabling work attribution for entity CV building. See Gas Town decision 009-session-events-architecture.md.
func MigrateCompactionConfig ¶
func MigrateCompositeIndexes ¶
func MigrateCreatedByColumn ¶
MigrateCreatedByColumn adds the created_by column to the issues table. This tracks who created the issue, using the same actor chain as comment authors (--actor flag, BD_ACTOR env, or $USER). GH#748.
func MigrateCrystallizesColumn ¶
MigrateCrystallizesColumn adds the crystallizes column to the issues table. Crystallizes tracks whether work compounds over time (true: code, features) or evaporates (false: ops, support). Per Decision 006, this affects CV weighting. Default is false (conservative - work evaporates unless explicitly marked).
func MigrateDevlogCascades ¶ added in v0.53.1
func MigrateDevlogCommitSHA ¶
func MigrateDevlogFileHash ¶
func MigrateDevlogSchema ¶
func MigrateDirtyIssuesTable ¶
func MigrateDropEdgeColumns ¶
MigrateDropEdgeColumns removes the deprecated edge fields from the issues table. This is Phase 4 of the Edge Schema Consolidation (Decision 004).
Removes columns: - replies_to (now: replies-to dependency) - relates_to (now: relates-to dependencies) - duplicate_of (now: duplicates dependency) - superseded_by (now: supersedes dependency)
Prerequisites: - Migration 021 (migrate_edge_fields) must have already run to convert data - All code must be updated to use the dependencies API
SQLite doesn't support DROP COLUMN directly in older versions, so we recreate the table without the deprecated columns.
func MigrateDueDeferColumns ¶
MigrateDueDeferColumns adds the due_at and defer_until columns to the issues table. These columns support time-based task scheduling (GH#820): - due_at: when the issue should be completed - defer_until: hide from bd ready until this time passes
func MigrateEdgeConsolidation ¶
MigrateEdgeConsolidation adds metadata and thread_id columns to the dependencies table. This is Phase 1 of the Edge Schema Consolidation (Decision 004): - metadata: JSON blob for type-specific edge data (similarity scores, reasons, etc.) - thread_id: For efficient conversation threading queries
These columns enable: - Edge metadata without schema changes (extensibility) - O(1) thread queries for Reddit-style conversations - HOP knowledge graph foundation
func MigrateEdgeFields ¶
MigrateEdgeFields migrates existing issue fields to dependency edges. This is Phase 3 of the Edge Schema Consolidation (Decision 004).
Migrates: - replies_to -> replies-to dependency with thread_id - relates_to -> relates-to dependencies - duplicate_of -> duplicates dependency - superseded_by -> supersedes dependency
This migration is idempotent: it uses INSERT OR IGNORE to skip edges that already exist (from Phase 2 dual-write).
func MigrateEntityAliasRegistry ¶ added in v0.53.1
func MigrateEntityDepsHardening ¶ added in v0.53.1
func MigrateEntityPreferredName ¶ added in v0.53.1
func MigrateEventFields ¶
MigrateEventFields adds event-specific fields to the issues table. These fields support type: event beads for operational state changes. Fields:
- event_kind: namespaced event type (e.g., patrol.muted, agent.started)
- actor: entity URI who caused this event
- target: entity URI or bead ID affected
- payload: event-specific JSON data
func MigrateGateColumns ¶
MigrateGateColumns adds gate-related columns to the issues table for async coordination. Gate fields enable agents to wait on external conditions (CI completion, human approval, etc.)
func MigrateHookedStatus ¶
MigrateHookedStatus converts pinned work items to hooked status. 'pinned' now means identity/domain records (agents, roles). 'hooked' means work actively attached to an agent's hook (GUPP).
func MigrateIsTemplateColumn ¶
MigrateIsTemplateColumn adds the is_template column to the issues table. Template issues (molecules) are read-only templates that should be filtered from work views by default (beads-1ra).
func MigrateMessagingFields ¶
MigrateMessagingFields adds messaging and graph link support columns to the issues table. These columns support inter-agent communication: - sender: who sent this message - ephemeral: can be bulk-deleted when closed - replies_to: issue ID for conversation threading - relates_to: JSON array of issue IDs for knowledge graph edges - duplicate_of: canonical issue ID (this is a duplicate) - superseded_by: replacement issue ID (this is obsolete)
func MigrateMolTypeColumn ¶
MigrateMolTypeColumn adds mol_type column to the issues table. This field distinguishes molecule types (swarm/patrol/work) for swarm coordination. Values: 'swarm' (multi-polecat coordination), 'patrol' (recurring ops), 'work' (regular, default)
func MigrateOrphanDetection ¶
MigrateOrphanDetection detects orphaned child issues and logs them for user action Orphaned children are issues with hierarchical IDs (e.g., "parent.1") where the parent issue no longer exists in the database.
Hierarchical IDs have the format {parentID}.{N} where N is a numeric child suffix. This correctly handles prefixes that contain dots (e.g., "my.project-abc123" is NOT hierarchical, but "my.project-abc123.1" IS hierarchical). See GH#508.
This migration does NOT automatically delete or convert orphans - it only logs them so the user can decide whether to: - Delete the orphans if they're no longer needed - Convert them to top-level issues by renaming them - Restore the missing parent issues
func MigrateOwnerColumn ¶
MigrateOwnerColumn adds the owner column to the issues table. This tracks the human owner responsible for the issue, using git author email for HOP CV (curriculum vitae) attribution chains. See Decision 008.
func MigratePinnedColumn ¶
MigratePinnedColumn adds the pinned column to the issues table. Pinned issues are persistent context markers that should not be treated as work items.
func MigratePopulateFTS ¶
MigratePopulateFTS ensures FTS tables are populated if the base tables are not empty. Since we used content='...', standard INSERTs don't auto-populate existing data. We must issue a 'rebuild' command.
func MigrateQualityScoreColumn ¶
MigrateQualityScoreColumn adds the quality_score column to the issues table. This stores an aggregate quality score (0.0-1.0) set by Refineries on merge. NULL indicates no score has been assigned yet.
func MigrateRemoveDependsOnFK ¶
MigrateRemoveDependsOnFK removes the FOREIGN KEY constraint on depends_on_id to allow external dependencies (external:<project>:<capability>). See bd-zmmy for design context.
func MigrateRepoMtimesTable ¶
func MigrateSnapshotsTable ¶
func MigrateSourceRepoColumn ¶
func MigrateSourceSystemColumn ¶
MigrateSourceSystemColumn adds the source_system column to the issues table. This tracks which adapter/system created the issue for federation support.
func MigrateTombstoneClosedAt ¶
MigrateTombstoneClosedAt updates the closed_at constraint to allow tombstones to retain their closed_at timestamp from before deletion.
Previously: CHECK ((status = 'closed') = (closed_at IS NOT NULL)) - This required clearing closed_at when creating tombstones from closed issues
Now: CHECK (closed + tombstone OR non-closed/tombstone with no closed_at) - closed issues must have closed_at - tombstones may have closed_at (from before deletion) or not - other statuses must NOT have closed_at
This allows importing tombstones that were closed before being deleted, preserving the historical closed_at timestamp for audit purposes.
func MigrateTombstoneColumns ¶
MigrateTombstoneColumns adds tombstone support columns to the issues table. These columns support inline soft-delete, replacing deletions.jsonl: - deleted_at: when the issue was deleted - deleted_by: who deleted the issue - delete_reason: why the issue was deleted - original_type: the issue type before deletion (for tombstones)
func MigrateWorkTypeColumn ¶
MigrateWorkTypeColumn adds work_type column to the issues table. This field distinguishes work assignment models per Decision 006. Values: 'mutex' (one worker, exclusive - default) or 'open_competition' (many submit, buyer picks)
Types ¶
This section is empty.
Source Files
¶
- 001_dirty_issues_table.go
- 002_external_ref_column.go
- 003_composite_indexes.go
- 004_closed_at_constraint.go
- 005_compaction_columns.go
- 006_snapshots_table.go
- 007_compaction_config.go
- 008_compacted_at_commit_column.go
- 009_export_hashes_table.go
- 010_content_hash_column.go
- 011_external_ref_unique.go
- 012_source_repo_column.go
- 013_repo_mtimes_table.go
- 014_child_counters_table.go
- 015_blocked_issues_cache.go
- 016_orphan_detection.go
- 017_close_reason_column.go
- 018_tombstone_columns.go
- 019_messaging_fields.go
- 020_edge_consolidation.go
- 021_migrate_edge_fields.go
- 022_drop_edge_columns.go
- 023_pinned_column.go
- 024_is_template_column.go
- 025_remove_depends_on_fk.go
- 026_additional_indexes.go
- 027_gate_columns.go
- 028_tombstone_closed_at.go
- 029_created_by_column.go
- 030_agent_fields.go
- 031_mol_type_column.go
- 032_hooked_status_migration.go
- 033_event_fields.go
- 034_closed_by_session_column.go
- 035_due_defer_columns.go
- 036_owner_column.go
- 037_crystallizes_column.go
- 038_work_type_column.go
- 039_source_system_column.go
- 040_quality_score_column.go
- 041_devlog_schema.go
- 042_devlog_file_hash.go
- 043_devlog_missing_flag.go
- 044_populate_fts.go
- 045_extraction_evol_schema.go
- 046_devlog_enrichment_status.go
- 047_devlog_author_columns.go
- 048_devlog_branch_column.go
- 050_devlog_ghost_column.go
- 051_branch_states_table.go
- 052_devlog_commit_sha.go
- 053_entity_deps_hardening.go
- 054_entity_alias_registry.go
- 055_entity_preferred_name.go
- 056_devlog_cascades.go