Hi, I am trying to host a Next.js 13 site with the new app router (using Neon and Drizzle) on Vercel, and I am slightly confused. Drizzle ORM docs suggest this snippet:
import { neon, neonConfig } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-http';
neonConfig.fetchConnectionCache = true;
const sql = neon(process.env.DRIZZLE_DATABASE_URL!);
const db = drizzle(sql);
const result = await db.select().from(...);
But at the same time, they mention " If you’re about to use Neon from a serverfull environments, according to their official nodejs docs(opens in a new tab) you should just use PostgresJS driver", in which case I connect like this:
import { drizzle, PostgresJsDatabase } from 'drizzle-orm/postgres-js';
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';
// for migrations
const migrationClient = postgres("postgres://postgres:adminadmin@0.0.0.0:5432/db", { max: 1 });
migrate(drizzle(migrationClient), ...)
// for query purposes
const queryClient = postgres("postgres://postgres:adminadmin@0.0.0.0:5432/db");
const db: PostgresJsDatabase = drizzle(queryClient);
await db.select().from(...)...
Which one is more appropriate, in case I want my Next.js 13 app to live on Vercel?
Many thanks!