Files
forge/server/reseed.ts
T

18 lines
647 B
TypeScript
Raw Normal View History

2026-08-29 11:59:28 +03:00
import 'dotenv/config';
import { pool, initDB, reseedFromArchives } from './db';
// CLI: reload the tickets table from server/data/*.json, replacing whatever is
// there. Use after regenerating the archives (e.g. from a Let it Snow storage
// dump via scripts/dump-to-archives.mjs). Destructive: TRUNCATEs tickets first.
// npx tsx server/reseed.ts (or: npm run reseed)
(async () => {
if (!process.env.DATABASE_URL) {
console.error('DATABASE_URL is required');
process.exit(1);
}
await initDB();
const n = await reseedFromArchives();
console.log(`Reseeded ${n} tickets from server/data archives`);
await pool.end();
})();