fix(store): post open chat task states once after the posted-status migration
This commit is contained in:
4 files changed
+23
-8
No files matched your search
@@ -750,17 +750,19 @@ func (q *Queries) LockTaskStatus(ctx context.Context, id int64) (string, error)
|
||||
}
|
||||
|
||||
const markOutcomePosted = `-- name: MarkOutcomePosted :exec
|
||||
UPDATE tasks SET outcome_posted_status = $2 WHERE id = $1
|
||||
UPDATE tasks SET outcome_posted_status = COALESCE(NULLIF($1::text, ''), status) WHERE id = $2
|
||||
`
|
||||
|
||||
type MarkOutcomePostedParams struct {
|
||||
ID int64
|
||||
OutcomePostedStatus string
|
||||
Posted string
|
||||
ID int64
|
||||
}
|
||||
|
||||
// Records the status whose state reached the task's conversation.
|
||||
// Records the status whose state reached the task's conversation. A caller
|
||||
// that names none (an older archied) marks the current status, so a mixed
|
||||
// deploy cannot leave a posted state looking unposted forever.
|
||||
func (q *Queries) MarkOutcomePosted(ctx context.Context, arg MarkOutcomePostedParams) error {
|
||||
_, err := q.db.Exec(ctx, markOutcomePosted, arg.ID, arg.OutcomePostedStatus)
|
||||
_, err := q.db.Exec(ctx, markOutcomePosted, arg.Posted, arg.ID)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user