| 1 | import { Connection } from "@/Prisma/Connection.ts"; |
| 2 | import { Postgres } from "@/Prisma/Postgres.ts"; |
| 3 | import { Project } from "@/Prisma/Project.ts"; |
| 4 | import { Stage } from "@/Stage.ts"; |
| 5 | import * as Effect from "effect/Effect"; |
| 6 | |
| 7 | /** |
| 8 | * Local Prisma Postgres used as the container's DATABASE_URL origin — the |
| 9 | * #1334 demo shape (arbitrary image + connection.directConnectionString). |
| 10 | */ |
| 11 | export const PrismaHostConnection = Effect.gen(function* () { |
| 12 | const project = yield* Project("PrismaHostProject", { |
| 13 | createDatabase: false, |
| 14 | }); |
| 15 | const database = yield* Postgres("PrismaHostDb", { |
| 16 | project, |
| 17 | name: "main", |
| 18 | dev: { |
| 19 | name: `alchemy-container-prisma-host-${yield* Stage}`, |
| 20 | persistenceMode: "stateless", |
| 21 | }, |
| 22 | }); |
| 23 | return yield* Connection("PrismaHostConnection", { database }); |
| 24 | }); |