o134's picture
Grouping tasks by day and monthly drafts (Python Upload)
b3b8f74 verified
Raw
History Blame Contribute Delete
341 Bytes
import Database from 'better-sqlite3';
const db = new Database('local.db');
const pastDate = new Date();
pastDate.setMonth(pastDate.getMonth() - 1);
const result = db.prepare("UPDATE tasks SET created_at = ? WHERE id = (SELECT id FROM tasks ORDER BY id ASC LIMIT 1)").run(pastDate.getTime());
console.log('Updated rows:', result.changes);