import { readFileSync } from 'fs'; import { Pool } from 'pg'; import { join } from 'path'; async function migrate() { const pool = new Pool({ connectionString: process.env.DATABASE_URL }); const sql = readFileSync(join(__dirname, 'schema.sql'), 'utf-8'); await pool.query(sql); console.log('✅ Migration complete'); await pool.end(); } migrate().catch((e) => { console.error('Migration failed:', e); process.exit(1); });