Spaces:
Runtime error
Runtime error
| 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); | |