-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Although SQLite handles transactions at the operation level, shouldn't the CLI provide a conditional update mechanism? That is, if I run the same update twice (or two agents try to update the same task), only the first one should succeed and the second one should fail.
Expected:
❯ track update SuR7TOU4 --summary "Looking for boots" --next "Put my feet in the boots" --status in_progress
Updated track: SuR7TOU4
Status: in_progress
❯ track update SuR7TOU4 --summary "Looking for boots" --next "Put my feet in the boots" --status in_progress
Update failed: Status is already in_progress
(or something similar - non-0 exit code and an error message)
Actual:
❯ track update SuR7TOU4 --summary "Looking for boots" --next "Put my feet in the boots" --status in_progress
Updated track: SuR7TOU4
Status: in_progress
❯ track update SuR7TOU4 --summary "Looking for boots" --next "Put my feet in the boots" --status in_progress
Updated track: SuR7TOU4
Status: in_progress
In order to be not so strict and backwards compatible, it could be implemented as an extra option like "--if-status planned" or "--conditional" or "--safe". E.g. UPDATE tracks SET status = 'in_progress' WHERE id = ? AND status = 'planned'; or UPDATE tracks SET status = 'in_progress' WHERE id = ? AND status != 'in_progress'; and then an error code if 0 rows are updated.
What do you think?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels