The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Prisma from "@alchemy.run/prisma"; |
| 2 | import { Stage } from "alchemy"; |
| 3 | import * as Config from "effect/Config"; |
| 4 | import * as Effect from "effect/Effect"; |
| 5 | |
| 6 | export const region = "eu-west-3" as const; |
| 7 | |
| 8 | export const appNameConfig = Effect.gen(function* () { |
| 9 | const stage = yield* Stage; |
| 10 | return yield* Config.String("PRISMA_EFFECT_APP").pipe( |
| 11 | Effect.orElseSucceed(() => `alchemy-prisma-compute-effect-${stage}`), |
| 12 | ); |
| 13 | }); |
| 14 | |
| 15 | export const Project = Prisma.Project( |
| 16 | "Project", |
| 17 | Effect.gen(function* () { |
| 18 | return { |
| 19 | name: yield* Config.String("PRISMA_PROJECT").pipe(Effect.orElseSucceed(() => undefined)), |
| 20 | createDatabase: false, |
| 21 | region, |
| 22 | }; |
| 23 | }), |
| 24 | ); |
| 25 | |
| 26 | export const Postgres = Prisma.Postgres( |
| 27 | "Postgres", |
| 28 | Effect.gen(function* () { |
| 29 | const project = yield* Project; |
| 30 | return { |
| 31 | project, |
| 32 | region, |
| 33 | // Project creation owns the default `main` branch. Select it by its |
| 34 | // Management API natural key instead of trying to create it again. |
| 35 | branchGitName: "main", |
| 36 | }; |
| 37 | }), |
| 38 | ); |
| 39 | |
| 40 | export const Connection = Prisma.Connection( |
| 41 | "Connection", |
| 42 | Effect.gen(function* () { |
| 43 | const postgres = yield* Postgres; |
| 44 | return { |
| 45 | database: postgres, |
| 46 | name: "api", |
| 47 | }; |
| 48 | }), |
| 49 | ); |