database
Create or adopt a named database project
When to use it
Create a Prisma or Drizzle database project, or bring an existing Prisma schema into your workspace. Existing schemas stay where they are unless you request relocation. If you move one, update client imports, build inputs, and migration commands together. For a new compiled client library, follow Build and consume a Prisma client.
Usage
npm exec -- nx generate @megamono/plugin:database --dry-runReplace angle-bracket placeholders with reviewed values. Nx's --dry-run previews generator writes; remove it only after reviewing the plan. Examples use npm; use your workspace's package manager if it differs.
Options
Use these options with @megamono/plugin:database. Nx uses the camelCase names shown here; the CLI reference describes command-line aliases. Some options are required only for particular choices.
| Option | Required | Type | Default | Description |
|---|---|---|---|---|
name | No | string | — | Repository-defined logical database name. |
adapter | No | string | — | Database schema and persistence adapter to scaffold. Allowed: "prisma", "drizzle". |
directory | No | string | — | Workspace-relative project root; defaults to libs/<adapter>/<name>. |
project | No | string | — | Nx project name; defaults to <scope>-<adapter>-<name>. |
target | No | string | — | Workspace-relative Playstack schema artifact destination. |
schema | No | string | — | Existing workspace-relative Prisma schema file to adopt without moving it. |
relocate | No | boolean | false | Move an existing Prisma schema directory into the selected context project after a conflict-free dry run. |
clientOutput | No | string | — | Optional project-relative generated client output, such as src/generated, during relocation or fresh buildable Prisma generation. |
buildable | No | boolean | false | Create a fresh Prisma 7 client library with ESM exports and a generate-then-compile build. Existing schemas and libraries are never converted. |
scope | No | string | — | — |
interactive | No | boolean | true | — |
yes | No | boolean | false | — |
dryRun | No | boolean | false | — |
Next steps
Review changed files and run the affected project's checks. For options that accept structured values, run the generator's --help or consult the schema in the installed package.