fix(dolt): parse timestamps from TEXT columns instead of direct time.Time scan
The Dolt storage was scanning created_at and updated_at directly into time.Time fields, but SQLite stores these as TEXT strings. The Go SQLite driver cannot automatically convert TEXT to time.Time. Added parseTimeString() helper and fixed all scan functions: - issues.go: scanIssue() - dependencies.go: scanIssueRow() - history.go: GetIssueHistory(), GetIssueAsOf() - transaction.go: scanIssueTx() Fixes bd-4dqmy Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
b63e7b8cf0
commit
2cc96197c0
@@ -410,6 +410,7 @@ func insertIssue(ctx context.Context, tx *sql.Tx, issue *types.Issue) error {
|
||||
|
||||
func scanIssue(ctx context.Context, db *sql.DB, id string) (*types.Issue, error) {
|
||||
var issue types.Issue
|
||||
var createdAtStr, updatedAtStr sql.NullString // TEXT columns - must parse manually
|
||||
var closedAt, compactedAt, deletedAt, lastActivity, dueAt, deferUntil sql.NullTime
|
||||
var estimatedMinutes, originalSize, timeoutNs sql.NullInt64
|
||||
var assignee, externalRef, compactedAtCommit, owner sql.NullString
|
||||
@@ -439,7 +440,7 @@ func scanIssue(ctx context.Context, db *sql.DB, id string) (*types.Issue, error)
|
||||
&issue.ID, &contentHash, &issue.Title, &issue.Description, &issue.Design,
|
||||
&issue.AcceptanceCriteria, &issue.Notes, &issue.Status,
|
||||
&issue.Priority, &issue.IssueType, &assignee, &estimatedMinutes,
|
||||
&issue.CreatedAt, &issue.CreatedBy, &owner, &issue.UpdatedAt, &closedAt, &externalRef,
|
||||
&createdAtStr, &issue.CreatedBy, &owner, &updatedAtStr, &closedAt, &externalRef,
|
||||
&issue.CompactionLevel, &compactedAt, &compactedAtCommit, &originalSize, &sourceRepo, &closeReason,
|
||||
&deletedAt, &deletedBy, &deleteReason, &originalType,
|
||||
&sender, &ephemeral, &pinned, &isTemplate, &crystallizes,
|
||||
@@ -457,6 +458,14 @@ func scanIssue(ctx context.Context, db *sql.DB, id string) (*types.Issue, error)
|
||||
return nil, fmt.Errorf("failed to get issue: %w", err)
|
||||
}
|
||||
|
||||
// Parse timestamp strings (TEXT columns require manual parsing)
|
||||
if createdAtStr.Valid {
|
||||
issue.CreatedAt = parseTimeString(createdAtStr.String)
|
||||
}
|
||||
if updatedAtStr.Valid {
|
||||
issue.UpdatedAt = parseTimeString(updatedAtStr.String)
|
||||
}
|
||||
|
||||
// Map nullable fields
|
||||
if contentHash.Valid {
|
||||
issue.ContentHash = contentHash.String
|
||||
|
||||
Reference in New Issue
Block a user