You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.prepare("SELECT id, timestamp, author, author_color, start_anchor, end_anchor, selected_text, content, status, parent_id FROM comments ORDER BY id ASC")
368
+
.map_err(|e| e.to_string())?;
369
+
370
+
let source_comments = stmt
371
+
.query_map([], |row| {
372
+
Ok(Comment{
373
+
id: row.get(0)?,
374
+
timestamp: row.get(1)?,
375
+
author: row.get(2)?,
376
+
author_color: row.get(3)?,
377
+
start_anchor: row.get(4)?,
378
+
end_anchor: row.get(5)?,
379
+
selected_text: row.get(6)?,
380
+
content: row.get(7)?,
381
+
status: row.get(8)?,
382
+
parent_id: row.get(9)?,
383
+
})
384
+
})
385
+
.map_err(|e| e.to_string())?
386
+
.collect::<Result<Vec<_>,_>>()
387
+
.map_err(|e| e.to_string())?;
388
+
389
+
// Map source ID -> Target ID
390
+
letmut id_map:HashMap<i64,i64> = HashMap::new();
391
+
392
+
for comment in source_comments {
393
+
// Check if equivalent comment exists in target
394
+
// We match on timestamp, author, and content to identify duplicates
395
+
let existing_id:Option<i64> = target_conn
396
+
.query_row(
397
+
"SELECT id FROM comments WHERE timestamp = ?1 AND author = ?2 AND content = ?3",
0 commit comments