Run migrations directly against Postgres
Schema changes
Neon · Const
A direct Neon connection string connects straight to Postgres without the pooler. In the Connect modal, disable Connection pooling to obtain it; use it for migrations, pg_dump, and LISTEN/NOTIFY.
A direct connection string targets Neon’s Postgres endpoint without the connection pooler. Obtain it from the Connect modal by disabling Connection pooling; the resulting URL contains the role, password, hostname, and database name.
postgresql://user:password@host/database?sslmode=require&channel_binding=requireA PostgreSQL connection URL for the selected Neon branch, compute, database, and role.
-pooler; a hostname containing that suffix routes through pooling.const connectionString = process.env.DATABASE_URL_UNPOOLED;
if (!connectionString) throw new Error("DATABASE_URL_UNPOOLED is required");
console.log(connectionString);Reads a direct Neon connection string from an environment variable for use by migrations or other session-dependent tooling.
Schema changes
Database administration
Session-dependent features
A direct connection goes straight to Postgres rather than through Neon’s pooler. Its hostname does not contain the -pooler suffix.
Follow-up: When should an application prefer the pooled endpoint? Use it when the application opens many concurrent connections, such as serverless workloads.
Open the project in the Neon Console, click Connect, select the branch, compute, database, and role, then disable Connection pooling and copy the URL.
Follow-up: What does the connection string identify? It includes the role, password, hostname, and database name.
Use a direct string for migrations, pg_dump, and LISTEN/NOTIFY, because these operations need direct or session-aware database behavior.
Follow-up: Why not use the pooled URL for every operation? Pooling changes connection handling and is intended primarily for high-concurrency application traffic.
Connection poolingpooled connection stringConnect to your branchpg_dumpLISTEN/NOTIFY