Desinger-System / lib /db /mock-date.js
o134's picture
Upload folder using huggingface_hub
1804b24 verified
Raw
History Blame Contribute Delete
444 Bytes
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);