feat(types): add tombstone support for inline soft-delete (bd-fbj)
Add tombstone types and schema migration as foundation for the tombstone epic (bd-vw8) which replaces deletions.jsonl with inline tombstones. Changes: - Add tombstone fields to Issue struct: DeletedAt, DeletedBy, DeleteReason, OriginalType - Add StatusTombstone constant and IsTombstone() helper method - Update Status.IsValid() to accept tombstone status - Create migration 018_tombstone_columns.go for new database columns - Update schema.go with tombstone columns: deleted_at, deleted_by, delete_reason, original_type - Update all issue insert/update/scan operations across: - issues.go (insertIssue, insertIssues) - queries.go (GetIssue, GetIssueByExternalRef, SearchIssues) - dependencies.go (scanIssues, scanIssuesWithDependencyType) - transaction.go (scanIssueRow, GetIssue, SearchIssues) - multirepo.go (import operations) - ready.go (GetReadyWork, GetStaleIssues) - labels.go (GetIssuesByLabel) - Add test for IsTombstone() helper - Update migration test to include tombstone columns Unblocks: bd-olt (TTL logic), bd-3b4 (delete command), bd-0ih (merge updates), bd-dve (import/export) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,11 @@ type Issue struct {
|
||||
Labels []string `json:"labels,omitempty"` // Populated only for export/import
|
||||
Dependencies []*Dependency `json:"dependencies,omitempty"` // Populated only for export/import
|
||||
Comments []*Comment `json:"comments,omitempty"` // Populated only for export/import
|
||||
// Tombstone fields (bd-vw8): inline soft-delete support
|
||||
DeletedAt *time.Time `json:"deleted_at,omitempty"` // When the issue was deleted
|
||||
DeletedBy string `json:"deleted_by,omitempty"` // Who deleted the issue
|
||||
DeleteReason string `json:"delete_reason,omitempty"` // Why the issue was deleted
|
||||
OriginalType string `json:"original_type,omitempty"` // Issue type before deletion (for tombstones)
|
||||
}
|
||||
|
||||
// ComputeContentHash creates a deterministic hash of the issue's content.
|
||||
@@ -69,6 +74,11 @@ func (i *Issue) ComputeContentHash() string {
|
||||
return fmt.Sprintf("%x", h.Sum(nil))
|
||||
}
|
||||
|
||||
// IsTombstone returns true if the issue has been soft-deleted (bd-vw8)
|
||||
func (i *Issue) IsTombstone() bool {
|
||||
return i.Status == StatusTombstone
|
||||
}
|
||||
|
||||
// Validate checks if the issue has valid field values (built-in statuses only)
|
||||
func (i *Issue) Validate() error {
|
||||
return i.ValidateWithCustomStatuses(nil)
|
||||
@@ -114,12 +124,13 @@ const (
|
||||
StatusInProgress Status = "in_progress"
|
||||
StatusBlocked Status = "blocked"
|
||||
StatusClosed Status = "closed"
|
||||
StatusTombstone Status = "tombstone" // Soft-deleted issue (bd-vw8)
|
||||
)
|
||||
|
||||
// IsValid checks if the status value is valid (built-in statuses only)
|
||||
func (s Status) IsValid() bool {
|
||||
switch s {
|
||||
case StatusOpen, StatusInProgress, StatusBlocked, StatusClosed:
|
||||
case StatusOpen, StatusInProgress, StatusBlocked, StatusClosed, StatusTombstone:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user