Analysis found these commands are dead code: - gt never calls `bd pin` - uses `bd update --status=pinned` instead - Beads.Pin() wrapper exists but is never called - bd hook functionality duplicated by gt mol status - Code comment says "pinned field is cosmetic for bd hook visibility" Removed: - cmd/bd/pin.go - cmd/bd/unpin.go - cmd/bd/hook.go 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package migrations
|
|
|
|
import (
|
|
"database/sql"
|
|
"fmt"
|
|
)
|
|
|
|
// MigratePinnedColumn adds the pinned column to the issues table.
|
|
// Pinned issues are persistent context markers that should not be treated as work items (bd-7h5).
|
|
func MigratePinnedColumn(db *sql.DB) error {
|
|
// Check if column already exists
|
|
var columnExists bool
|
|
err := db.QueryRow(`
|
|
SELECT COUNT(*) > 0
|
|
FROM pragma_table_info('issues')
|
|
WHERE name = 'pinned'
|
|
`).Scan(&columnExists)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to check pinned column: %w", err)
|
|
}
|
|
|
|
if columnExists {
|
|
// Column exists (e.g. created by new schema); ensure index exists.
|
|
_, err = db.Exec(`CREATE INDEX IF NOT EXISTS idx_issues_pinned ON issues(pinned) WHERE pinned = 1`)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to create pinned index: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Add the pinned column
|
|
_, err = db.Exec(`ALTER TABLE issues ADD COLUMN pinned INTEGER DEFAULT 0`)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to add pinned column: %w", err)
|
|
}
|
|
|
|
// Add index for pinned issues (for efficient filtering)
|
|
_, err = db.Exec(`CREATE INDEX IF NOT EXISTS idx_issues_pinned ON issues(pinned) WHERE pinned = 1`)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to create pinned index: %w", err)
|
|
}
|
|
|
|
return nil
|
|
}
|