diff --git a/src/cli/commands/ingest.rs b/src/cli/commands/ingest.rs index b7e309a..d752e2e 100644 --- a/src/cli/commands/ingest.rs +++ b/src/cli/commands/ingest.rs @@ -67,18 +67,26 @@ pub async fn run_ingest( // Get projects to sync let projects = get_projects_to_sync(&conn, &config.projects, project_filter)?; - // If --full flag is set, reset sync cursors for a complete re-fetch + // If --full flag is set, reset sync cursors and discussion watermarks for a complete re-fetch if full { println!( "{}", style("Full sync: resetting cursors to fetch all data...").yellow() ); for (local_project_id, _, path) in &projects { + // Reset discussion watermarks first so discussions get re-synced + conn.execute( + "UPDATE issues SET discussions_synced_for_updated_at = NULL WHERE project_id = ?", + [*local_project_id], + )?; + + // Then reset sync cursor conn.execute( "DELETE FROM sync_cursors WHERE project_id = ? AND resource_type = ?", (*local_project_id, resource_type), )?; - tracing::info!(project = %path, "Reset sync cursor for full re-fetch"); + + tracing::info!(project = %path, "Reset sync cursor and discussion watermarks for full re-fetch"); } }