feat(cleanup): protect pinned issues from cleanup/compact (bd-b2k)
Add Pinned field to Issue struct and database schema to protect issues from accidental deletion via cleanup or compaction. Changes: - Add Pinned bool field to types.Issue - Create migration 023_pinned_column.go for database schema - Filter out pinned issues in cleanup command before deletion - Add pinned check to GetTier1Candidates and GetTier2Candidates - Add pinned check to CheckEligibility for compaction - Update all SQL queries and scan functions to include pinned field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -126,6 +126,22 @@ SEE ALSO:
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Filter out pinned issues - they are protected from cleanup (bd-b2k)
|
||||
pinnedCount := 0
|
||||
filteredIssues := make([]*types.Issue, 0, len(closedIssues))
|
||||
for _, issue := range closedIssues {
|
||||
if issue.Pinned {
|
||||
pinnedCount++
|
||||
continue
|
||||
}
|
||||
filteredIssues = append(filteredIssues, issue)
|
||||
}
|
||||
closedIssues = filteredIssues
|
||||
|
||||
if pinnedCount > 0 && !jsonOutput {
|
||||
fmt.Printf("Skipping %d pinned issue(s) (protected from cleanup)\n", pinnedCount)
|
||||
}
|
||||
|
||||
if len(closedIssues) == 0 {
|
||||
if jsonOutput {
|
||||
result := map[string]interface{}{
|
||||
|
||||
Reference in New Issue
Block a user