prisma-client-cli
v0.1.1
Published
Generates a CLI from your Prisma schema that allows you to query, seed, and export data
Downloads
8
Readme
Prisma Client CLI
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
Install the generator and oclif:
npm install prisma-client-cli @oclif/core --save-dev
Add the generator to your Prisma schema:
generator cli { provider = "prisma-client-cli" }
Run Prisma's
generate
command to generate the CLI in the./prisma/cli/
directory:npx prisma generate
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