Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kgajera/prisma-client-cli
Generates a CLI from your Prisma schema that allows you to query, seed, and export data
https://github.com/kgajera/prisma-client-cli
Last synced: 21 days ago
JSON representation
Generates a CLI from your Prisma schema that allows you to query, seed, and export data
- Host: GitHub
- URL: https://github.com/kgajera/prisma-client-cli
- Owner: kgajera
- License: mit
- Created: 2022-11-22T02:17:57.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-03T03:04:42.000Z (almost 2 years ago)
- Last Synced: 2024-10-19T07:11:40.284Z (about 1 month ago)
- Language: TypeScript
- Homepage:
- Size: 182 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Prisma Client CLI
[![npm](https://img.shields.io/npm/v/prisma-client-cli)](https://www.npmjs.com/package/prisma-client-cli)
[![CI](https://github.com/kgajera/prisma-client-cli/actions/workflows/CI.yml/badge.svg)](https://github.com/kgajera/prisma-client-cli/actions/workflows/CI.yml)A Prisma [generator](https://www.prisma.io/docs/concepts/components/prisma-schema/generators) that generates a command-line interface from your Prisma schema using [oclif](https://oclif.io). Use the CLI to run queries, seed records, or export your query results to a CSV file.
View the [example project](/example) to see it in action.
## Getting Started
1. Install the generator and oclif:
```
npm install prisma-client-cli @oclif/core --save-dev
```1. Add the generator to your Prisma schema:
```prisma
generator cli {
provider = "prisma-client-cli"
}
```1. Run Prisma's [`generate`](https://www.prisma.io/docs/reference/api-reference/command-reference#generate) command to generate the CLI in the `./prisma/cli/` directory:
```
npx prisma generate
```1. Add the following configuration for oclif to your `package.json`:
```json
"oclif": {
"commands": "./prisma/cli/commands",
"topicSeparator": " "
}
```
For more information about oclif's configuration, refer to their [documentation](https://oclif.io).## 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
```