/**
 * Initialises / migrates the SQLite database. The app also does this lazily on
 * first request, but running this once during deploy makes the DB file exist
 * up front. Run with:  npm run migrate
 */
import { loadEnv } from './load-env';
loadEnv();

import { getDb } from '../lib/db';

const db = getDb();
const tables = db
  .prepare("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name")
  .all() as { name: string }[];

console.log('✅ Database ready. Tables:');
for (const t of tables) console.log('   -', t.name);
