Execute Plan: Updated_at being manually updated (vibe-kanban) #278
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Plan: Implement Automatic updated_at Triggers for SQLite Database
Current Findings Summary
Database Technology
Tables with updated_at Columns
/private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vibe-kanban/vk-69ad-updated-at/backend/migrations/20250617183714_init.sql:9
/private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vibe-kanban/vk-69ad-updated-at/backend/migrations/20250617183714_init.sql:20
/private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vibe-kanban/vk-69ad-updated-at/backend/migrations/20250620214100_remove_stdout_stderr_from_task_attempts.sql:15
/private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vibe-kanban/vk-69ad-updated-at/backend/migrations/20250620212427_execution_processes.sql:19
/private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vibe-kanban/vk-69ad-updated-at/backend/migrations/20250715154859_add_task_templates.sql:9
/private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vibe-kanban/vk-69ad-updated-at/backend/migrations/20250623120000_executor_sessions.sql:10
Current Manual Update Patterns
Heavy manual management - 15+ locations where
updated_at
is manually set:execution_process.rs (4 manual updates):
SET status = $1, exit_code = $2, completed_at = $3, updated_at = datetime('now')
SET stdout = COALESCE(stdout, '') || $1, updated_at = datetime('now')
SET stderr = COALESCE(stderr, '') || $1, updated_at = datetime('now')
task_attempt.rs (8 manual updates):
SET worktree_deleted = TRUE, updated_at = datetime('now')
SET merge_commit = $1, updated_at = datetime('now')
SET worktree_path = $1, worktree_deleted = FALSE, setup_completed_at = NULL, updated_at = datetime('now')
SET base_branch = $1, updated_at = datetime('now')
SET pr_url = $1, pr_number = $2, pr_status = $3, updated_at = datetime('now')
SET pr_status = $1, pr_merged_at = $2, merge_commit = $3, updated_at = datetime('now')
SET setup_completed_at = datetime('now'), updated_at = datetime('now')
task_template.rs (1 manual update):
SET title = $2, description = $3, template_name = $4, updated_at = datetime('now', 'subsec')
executor_session.rs (3 manual updates):
SET session_id = $1, updated_at = datetime('now')
SET prompt = $1, updated_at = datetime('now')
SET summary = $1, updated_at = datetime('now')
task.rs (1 manual update):
SET status = $3, updated_at = CURRENT_TIMESTAMP
Missing manual updates:
projects
table update function doesn't manually setupdated_at
(Line 167 in project.rs)Implementation Plan
1. Create SQLite Triggers Migration
Create a new migration file that will:
AFTER UPDATE
triggers for each table withupdated_at
columnsdatetime('now', 'subsec')
for consistency with existing patternsupdated_at
is already being explicitly set2. Update Strategy
updated_at
assignments in the codebase (separate task)3. Migration Details
The migration will create triggers for:
projects_updated_at_trigger
tasks_updated_at_trigger
task_attempts_updated_at_trigger
execution_processes_updated_at_trigger
task_templates_updated_at_trigger
executor_sessions_updated_at_trigger
Each trigger will:
updated_at
when the row actually changes (usingNEW.*
!=OLD.*
comparisons)updated_at
was manually set4. Verification
After implementing triggers:
updated_at
Would you like me to proceed with creating this migration?