# Prisma on boxd

> Prisma Data Platform provides database tools including Accelerate (global database cache), Optimize (AI-driven query analysis), and Prisma Postgres (managed PostgreSQL). Manage workspaces, projects, environments, and API keys programmatically.

- Page: https://boxd.sh/integrations/prisma/
- CLI: `run prisma` (22 commands, 19 marked common)
- SDK: `import { prisma } from "@boxd/run"`; every parameter and response type is at `@boxd/run/prisma`
- Triggers: none
- Connect: `run auth prisma` (Sign in with Prisma), or https://app.boxd.sh/integrations/detail/prisma
- All integrations: https://boxd.sh/integrations/ (Markdown: https://boxd.sh/integrations/index.md)

## From the shell

```sh
run auth prisma      # once: prints a link to connect your account
run prisma           # list its commands
run prisma list-projects
```

Parameters are flags (`--flag value`); object and array parameters take a JSON string. Output is YAML, or JSON with `--json`. Calls use your own connection; `--scope <name>` uses a connection shared with your team.

## From a script

```ts
import { every, prisma } from "@boxd/run";

every("1 hour", async () => {
  const result = await prisma.listProjects({});
  console.log(result);
});
```

Run it with `run prisma.run.ts`. Prisma has no triggers; `every()` polls on a schedule, keeps the script running as a job, and wakes the machine when it is due.

## Commands

Required flags are listed; `run prisma <command> --help` lists the optional ones. "common" marks what `run prisma` shows without `--all`.

| Command | SDK method | Required flags | Optional | Description |
|---|---|---|---|---|
| `create-connection` ·common | `prisma.createConnection()` | `--databaseId` `--name` | 0 | Create new API key connection for database access |
| `create-database` ·common | `prisma.createDatabase()` | `--name` `--projectId` `--region` | 1 | Create new postgres database in an existing Prisma project |
| `create-project` ·common | `prisma.createProject()` | `--name` `--region` | 0 | Create new Prisma project with managed postgres database |
| `delete-connection` | `prisma.deleteConnection()` | `--id` | 0 | Permanently delete database connection and revoke API key access |
| `delete-database` | `prisma.deleteDatabase()` | `--databaseId` | 0 | Permanently delete Prisma database and all stored data |
| `delete-project` | `prisma.deleteProject()` | `--id` | 0 | Permanently delete Prisma project and all associated resources |
| `execute-sql-command` ·common | `prisma.executeSqlCommand()` | `--command` `--connectionString` | 1 | Execute SQL commands that modify database data or structure |
| `execute-sql-query` ·common | `prisma.executeSqlQuery()` | `--host` `--password` `--query` `--user` | 1 | Execute SQL SELECT queries against Prisma Postgres databases |
| `get-database` ·common | `prisma.getDatabase()` | `--databaseId` | 0 | Retrieve specific Prisma database by ID |
| `get-database-usage` ·common | `prisma.getDatabaseUsage()` | `--databaseId` | 2 | Retrieve usage metrics for a specific Prisma database |
| `get-project` ·common | `prisma.getProject()` | `--id` | 0 | Retrieve specific Prisma project by ID |
| `inspect-database-schema` ·common | `prisma.inspectDatabaseSchema()` | `--host` `--password` `--user` | 2 | Inspect database schema structure and table information |
| `list-accelerate-regions` ·common | `prisma.listAccelerateRegions()` | — | 0 | Retrieve all available regions for Prisma Accelerate |
| `list-backups` ·common | `prisma.listBackups()` | `--databaseId` | 1 | Retrieve list of available backups for a specific database |
| `list-connections` ·common | `prisma.listConnections()` | `--databaseId` | 2 | Retrieve paginated list of connections for a specific database |
| `list-databases` ·common | `prisma.listDatabases()` | `--projectId` | 2 | Retrieve paginated list of databases for a specific Prisma project |
| `list-postgres-regions` ·common | `prisma.listPostgresRegions()` | — | 0 | Retrieve all available regions for Prisma Postgres |
| `list-projects` ·common | `prisma.listProjects()` | — | 2 | Retrieve paginated list of Prisma projects accessible to authenticated user |
| `list-workspace-integrations` ·common | `prisma.listWorkspaceIntegrations()` | `--workspaceId` | 2 | Retrieve paginated list of integrations for a specific Prisma workspace |
| `list-workspaces` ·common | `prisma.listWorkspaces()` | — | 2 | Retrieve paginated list of Prisma workspaces accessible to authenticated user |
| `restore-backup` ·common | `prisma.restoreBackup()` | `--backupId` `--databaseId` `--targetDatabaseName` | 0 | Restore database backup to new database instance |
| `transfer-project` ·common | `prisma.transferProject()` | `--id` `--recipientAccessToken` | 0 | Transfer Prisma project ownership to another user's workspace |

## Docs

- [run CLI](https://docs.boxd.sh/cli/run): Call connected integrations from the shell, connect new ones, and run automations.
- [Quickstart](https://docs.boxd.sh/guides/integrations/quickstart): Connect an integration, call it from the shell, and turn a script into an automation.
- [Connections](https://docs.boxd.sh/guides/integrations/connections): Connect an account once, for yourself or for your whole organization.
- [Scripts](https://docs.boxd.sh/guides/automations/scripts): Typed integrations, triggers, schedules and state in a .run.ts file.
- [Jobs](https://docs.boxd.sh/guides/automations/jobs): How a script becomes a background job: states, retries, sleep and wake.
- [Beyond the catalog](https://docs.boxd.sh/guides/automations/beyond-the-catalog): Reach your own APIs, databases and cloud accounts from a script.
