Spaces:
Runtime error
Runtime error
File size: 444 Bytes
1804b24 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import { db, tasksTable } from './src/index.js';
import { eq } from 'drizzle-orm';
async function main() {
const pastDate = new Date();
pastDate.setMonth(pastDate.getMonth() - 1);
const tasks = await db.select().from(tasksTable);
if (tasks.length > 0) {
await db.update(tasksTable).set({ createdAt: pastDate }).where(eq(tasksTable.id, tasks[0].id));
console.log('Updated row', tasks[0].id);
}
}
main().catch(console.error);
|