File size: 341 Bytes
1804b24
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
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);