18 lines
647 B
TypeScript
18 lines
647 B
TypeScript
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();
|
|
})();
|