Workspace
Alchemy exposes a utility to easily reference Prisma Postgres workspaces by name or id.
Minimal Example
Section titled “Minimal Example”import { WorkspaceRef } from "alchemy/prisma-postgres";
const workspace = await WorkspaceRef("my-workspace");
Using Multiple Workspaces
Section titled “Using Multiple Workspaces”Prisma Postgres service tokens are scoped to a workspace. In order to use multiple workspaces, you can override the serviceToken
to the token for the workspace needed.
const workspaceAProject = await Project("workspace-a-project", { serviceToken: alchemy.env.PRISMA_SERVICE_TOKEN_WORKSPACE_A,});
const workspaceBProject = await Project("workspace-b-project", { serviceToken: alchemy.env.PRISMA_SERVICE_TOKEN_WORKSPACE_B,});