From 6c2442a82b21d5e2fde8f8cd2a82897f7dd175e0 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 6 Mar 2025 14:32:52 +0300 Subject: [PATCH] fix(db): edit add_selected_property fn to Insert URL if it does not exists. --- src/db.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/db.rs b/src/db.rs index b18a21f..c2ceff8 100644 --- a/src/db.rs +++ b/src/db.rs @@ -552,6 +552,12 @@ mod db_impl { let mut conn = self.conn.lock().await; let tx = conn.transaction()?; + // Insert URL if it does not exists + tx.execute( + "INSERT OR IGNORE INTO urls (url) VALUES (?)", + [url] + )?; + // Get URL ID let url_id = tx.query_row( "SELECT id FROM urls WHERE url = ?",