Files
2026-03-18 18:26:24 +08:00

17 lines
438 B
TypeScript

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);
});