1+ diff --git a/lib/Drizzle/Postgres.d.ts b/lib/Drizzle/Postgres.d.ts
2+ index ddba2e1e6ae85ca24e626ce2d7ea2bde92ef6f86..31335e2039a52ad2fe7a12d6bc820dbb04fe15a8 100644
3+ --- a/lib/Drizzle/Postgres.d.ts
4+ +++ b/lib/Drizzle/Postgres.d.ts
5+ @@ -4,6 +4,11 @@ import type { EffectPgDatabase } from "drizzle-orm/effect-postgres";
6+ import type { EffectDrizzlePgConfig } from "drizzle-orm/pg-core/effect/utils";
7+ import * as Effect from "effect/Effect";
8+ import type * as Redacted from "effect/Redacted";
9+ + /**
10+ + * `@effect/sql-pg` client settings that cannot be carried in the URL, e.g.
11+ + * `prepare: false` for transaction-mode poolers such as Hyperdrive.
12+ + */
13+ + export type PostgresClientOptions = Omit<PgClient.PgPoolConfig, "url" | "ssl">;
14+ /**
15+ * Open a Drizzle/Postgres database from a connection URL using the
16+ * `drizzle-orm/effect-postgres` integration.
17+ @@ -39,7 +44,7 @@ import type * as Redacted from "effect/Redacted";
18+ *
19+ * @binding
20+ */
21+ - export declare const Postgres: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(connectionString: Effect.Effect<Redacted.Redacted<string>, E, R>, config?: EffectDrizzlePgConfig<TRelations>) => Effect.Effect<EffectPgDatabase<TRelations> & {
22+ + export declare const Postgres: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(connectionString: Effect.Effect<Redacted.Redacted<string>, E, R>, config?: EffectDrizzlePgConfig<TRelations>, pgClient?: PostgresClientOptions) => Effect.Effect<EffectPgDatabase<TRelations> & {
23+ $client: PgClient.PgClient;
24+ }, never, never>;
25+ //# sourceMappingURL=Postgres.d.ts.map
26+ \ No newline at end of file
27+ diff --git a/lib/Drizzle/Postgres.js b/lib/Drizzle/Postgres.js
28+ index fdd0942fc9da4f220e135bd9ce6c891dd837a948..e7452288b6b92e0aeacc26f37a10e85a3ba232e5 100644
29+ --- a/lib/Drizzle/Postgres.js
30+ +++ b/lib/Drizzle/Postgres.js
31+ @@ -38,13 +38,13 @@ import { proxyChain } from "../Util/proxy-chain.js";
32+ *
33+ * @binding
34+ */
35+ - export const Postgres = (connectionString, config) => Effect.map(makeExecutionMemo(Effect.gen(function* () {
36+ + export const Postgres = (connectionString, config, pgClient) => Effect.map(makeExecutionMemo(Effect.gen(function* () {
37+ const [PgClient, PgDrizzle] = yield* Effect.promise(() => Promise.all([
38+ import("@effect/sql-pg/PgClient"),
39+ import("drizzle-orm/effect-postgres"),
40+ ]));
41+ const url = yield* connectionString;
42+ - const pgCtx = yield* Layer.build(PgClient.layer(resolveConnectionOptions(url)));
43+ + const pgCtx = yield* Layer.build(PgClient.layer({ ...pgClient, ...resolveConnectionOptions(url) }));
44+ return yield* PgDrizzle.makeWithDefaults(config).pipe(Effect.provideContext(pgCtx));
45+ })), (db) => proxyChain(db));
46+ //# sourceMappingURL=Postgres.js.map
47+ \ No newline at end of file
148diff --git a/lib/Test/Vitest.js b/lib/Test/Vitest.js
249index 0ecf9ccff01bb6556bf3e471d5a93254d16224a7..c0f1237e6a98e698718b0bbde5de8eb58c859e8e 100644
350--- a/lib/Test/Vitest.js
@@ -11,6 +58,43 @@ index 0ecf9ccff01bb6556bf3e471d5a93254d16224a7..c0f1237e6a98e698718b0bbde5de8eb5
1158 import * as Core from "./Core.js";
1259 export { executeWhenReady, getWhenReady, guardContentType, guardedFetchLayer, rpcClientLayer, WorkerNotReady, } from "./Http.js";
1360 export const defaultStage = Core.defaultStage;
61+ diff --git a/src/Drizzle/Postgres.ts b/src/Drizzle/Postgres.ts
62+ index 2d138914e834d5c47078c42b756129897506f51d..61ae549db6ee20e8809295e8d1543b3bc78f63ad 100644
63+ --- a/src/Drizzle/Postgres.ts
64+ +++ b/src/Drizzle/Postgres.ts
65+ @@ -48,6 +48,15 @@ import { proxyChain } from "../Util/proxy-chain.ts";
66+ * @binding
67+ */
68+
69+ + /**
70+ + * `@effect/sql-pg` client settings that cannot be carried in the URL, e.g.
71+ + * `prepare: false` for transaction-mode poolers such as Hyperdrive.
72+ + */
73+ + export type PostgresClientOptions = Omit<
74+ + PgClient.PgPoolConfig,
75+ + "url" | "ssl"
76+ + >;
77+ +
78+ export const Postgres = <
79+ TRelations extends AnyRelations = EmptyRelations,
80+ E = never,
81+ @@ -55,6 +64,7 @@ export const Postgres = <
82+ >(
83+ connectionString: Effect.Effect<Redacted.Redacted<string>, E, R>,
84+ config?: EffectDrizzlePgConfig<TRelations>,
85+ + pgClient?: PostgresClientOptions,
86+ ) =>
87+ Effect.map(
88+ makeExecutionMemo(
89+ @@ -67,7 +77,7 @@ export const Postgres = <
90+ );
91+ const url = yield* connectionString;
92+ const pgCtx = yield* Layer.build(
93+ - PgClient.layer(resolveConnectionOptions(url)),
94+ + PgClient.layer({ ...pgClient, ...resolveConnectionOptions(url) }),
95+ );
96+ return yield* PgDrizzle.makeWithDefaults(config).pipe(
97+ Effect.provideContext(pgCtx),
1498diff --git a/src/Test/Vitest.ts b/src/Test/Vitest.ts
1599index c321e6d4924d0f6b3ae53292a12af88167692ccb..673929a81d066bdd6a2dd94e9c1d95bb69f3e3cd 100644
16100--- a/src/Test/Vitest.ts
0 commit comments