I'm trying to replace this INSERT statement with an UPSERT (now supported in sqlite)
55 await db.query(
56 "INSERT OR REPLACE INTO urls(url, title, excerpt, created_at, updated_at) VALUES (?, ?, ?, ?, ?)",
57 [url, article.title, article.excerpt, new Date().toISOString(), new Date().toISOString()],
58 );
I want to keep the original created_at timestamp and the other properties (aside from url which is the key) can be updated if the row already exists.
Bonus points if you can also add a count = count + 1 column to the table for tracking views.