From ccbdde22e00ce26557351d4e644b6fbf90c15bce Mon Sep 17 00:00:00 2001 From: Martin DONADIEU Date: Wed, 12 Nov 2025 11:24:02 +0100 Subject: [PATCH] docs: Update connection string logic for Docker compatibility (#40288) Adapt connection string handling for Docker resolver in Supabase. --- apps/docs/content/guides/database/drizzle.mdx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/docs/content/guides/database/drizzle.mdx b/apps/docs/content/guides/database/drizzle.mdx index 9c1914df45b..88a02df030e 100644 --- a/apps/docs/content/guides/database/drizzle.mdx +++ b/apps/docs/content/guides/database/drizzle.mdx @@ -68,6 +68,8 @@ If you plan on solely using Drizzle instead of the Supabase Data API (PostgREST) From the project [**Connect** panel](/dashboard/project/_?showConnect=true), copy the URI from the "Shared Pooler" option and save it as the `DATABASE_URL` environment variable. Remember to replace the password placeholder with your actual database password. + In local SUPABASE_DB_URL require to be adapted to work with Docker resolver + @@ -78,7 +80,12 @@ If you plan on solely using Drizzle instead of the Supabase Data API (PostgREST) import { drizzle } from 'drizzle-orm/postgres-js' import postgres from 'postgres' - const connectionString = process.env.DATABASE_URL + let connectionString = process.env.DATABASE_URL + if (host.includes('postgres:postgres@supabase_db_')) { + const url = URL.parse(host)! + url.hostname = url.hostname.split('_')[1] + connectionString = url.href + } // Disable prefetch as it is not supported for "Transaction" pool mode export const client = postgres(connectionString, { prepare: false })