import postgres from 'postgres';
import { readFileSync } from 'fs';
import { join } from 'path';

const connectionString =
  process.env.POSTGRES_URL ?? 'postgresql://gooseek:gooseek@localhost:5432/gooseek';
const client = postgres(connectionString);

async function main() {
  const sql = readFileSync(join(process.cwd(), 'drizzle/0000_init.sql'), 'utf8');
  await client.unsafe(sql);
  console.log('Profile schema applied');
  await client.end();
}
main().catch((e) => {
  console.error(e);
  process.exit(1);
});
