feat: add event cleanup scripts and Docker Compose setup for automated maintenance

This commit is contained in:
Arunavo Ray
2025-05-21 02:25:05 +05:30
parent 6d13ff29ca
commit 04e8b817d3
9 changed files with 207 additions and 8 deletions

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bun
/**
* Script to mark all events as read
*/
import { db, events } from "../src/lib/db";
import { eq } from "drizzle-orm";
async function markEventsAsRead() {
try {
console.log("Marking all events as read...");
// Update all events to mark them as read
const result = await db
.update(events)
.set({ read: true })
.where(eq(events.read, false));
console.log(`Marked ${result.changes || 0} events as read`);
} catch (error) {
console.error("Error marking events as read:", error);
process.exit(1);
}
}
// Run the function
markEventsAsRead();