prisma-client-cli
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Prisma Client CLI

npm CI

A Prisma generator that generates a command-line interface from your Prisma schema using oclif. Use the CLI to run queries, seed records, or export your query results to a CSV file.

View the example project to see it in action.

Getting Started

  1. Install the generator and oclif:

    npm install prisma-client-cli @oclif/core --save-dev
    
  2. Add the generator to your Prisma schema:

    generator cli {
      provider = "prisma-client-cli"
    }
  3. Run Prisma's generate command to generate the CLI in the ./prisma/cli/ directory:

    npx prisma generate
    
  4. Add the following configuration for oclif to your package.json:

    "oclif": {
      "commands": "./prisma/cli/commands",
      "topicSeparator": " "
    }

    For more information about oclif's configuration, refer to their documentation.

CLI Usage

Run ./prisma/cli/bin/run --help to view available commands for your generated CLI.

Exporting to CSV

Use the --_csv flag to output the query results as comma-separated values.

Disable Generator

You can prevent the CLI from being generated by setting the following environment variable:

PRISMA_CLIENT_CLI=false

/prisma-client-cli/

    Package Sidebar

    Install

    npm i prisma-client-cli

    Weekly Downloads

    1

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    32 kB

    Total Files

    13

    Last publish

    Collaborators

    • kgajera