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,29 @@
#!/usr/bin/env bun
/**
* Script to make events appear older for testing cleanup
*/
import { db, events } from "../src/lib/db";
async function makeEventsOld() {
try {
console.log("Making events appear older...");
// Calculate a timestamp from 2 days ago
const oldDate = new Date();
oldDate.setDate(oldDate.getDate() - 2);
// Update all events to have an older timestamp
const result = await db
.update(events)
.set({ createdAt: oldDate });
console.log(`Updated ${result.changes || 0} events to appear older`);
} catch (error) {
console.error("Error updating event timestamps:", error);
process.exit(1);
}
}
// Run the function
makeEventsOld();