Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add example on how to use prisma init --preview-feature #5403

Merged
merged 10 commits into from
Oct 30, 2023
68 changes: 60 additions & 8 deletions content/400-reference/200-api-reference/200-command-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,13 @@ The `init` command does not interpret any existing files. Instead, it creates a

#### Arguments

| Argument | Required | Description | Default |
|-------------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|
| `--datasource-provider` | No | Specifies the default value for the `provider` field in the `datasource` block. Options are `sqlite`, `postgresql`, `mysql`, `sqlserver`, `mongodb` and `cockroachdb`. | `postgresql` |
| `--url` | No | Define a custom datasource url. | |
| `--generator-provider` | No | Define the default generator provider to use. | `prisma-client-js` |
| `--preview-features` | No | Define the default Preview features to use. [Learn more](/concepts/components/preview-features) | |
| `--output` | No | Specifies the default output location for the generated client. [Learn more](/concepts/components/prisma-client/working-with-prismaclient/generating-prisma-client#using-a-custom-output-path) | `node_modules/.prisma/client` |
| Argument | Required | Description | Default |
| ----------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
| `--datasource-provider` | No | Specifies the value for the `provider` field in the `datasource` block. Options are `sqlite`, `postgresql`, `mysql`, `sqlserver`, `mongodb` and `cockroachdb`. | `postgresql` |
| `--url` | No | Define a custom datasource url. | |
| `--generator-provider` | No | Define the generator provider to use. | `prisma-client-js` |
| `--preview-feature` | No | Define the [Preview features](/concepts/components/preview-features) to use. To define multiple Preview features, you have to provide the flag multiple times for each Preview feature. [See example](#run-prisma-init---preview-feature) | |
| `--output` | No | Specifies the [output location for the generated client](/concepts/components/prisma-client/working-with-prismaclient/generating-prisma-client#using-a-custom-output-path). | `node_modules/.prisma/client` |

#### Examples

Expand Down Expand Up @@ -356,6 +356,58 @@ prisma init --datasource-provider sqlite

The command output contains helpful information on how to use the generated files and begin using Prisma with your project.

#### Run `prisma init --preview-feature`

<CodeWithResult outputResultText="Prisma schema" expanded={true}>

<cmd>```terminal prisma init --preview-feature multiSchema```</cmd>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is broken and not displayed @ruheni
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a PR here: #5410


<cmdResult>

```prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

generator client {
provider = "prisma-client-js"
previewFeatures = ["multiSchema"]
}
```

</cmdResult>

</CodeWithResult>

<CodeWithResult outputResultText="Prisma schema" expanded={true}>

<cmd>

```terminal
prisma init --preview-feature multiSchema --preview-feature metrics
```

</cmd>

<cmdResult>

```prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

generator client {
provider = "prisma-client-js"
previewFeatures = ["multiSchema", "metrics"]
}
```

</cmdResult>

</CodeWithResult>

#### Generated Assets

**`prisma/schema.prisma`**
Expand Down Expand Up @@ -997,7 +1049,7 @@ Other options:
- Take the SQL script from standard input and execute it on the database specified by the data source URL given in the `DATABASE_URL` environment variable:

```terminal wrap
$ echo 'TRUNCATE TABLE dev;' | prisma db execute --stdin --url="$DATABASE_URL"
echo 'TRUNCATE TABLE dev;' | prisma db execute --stdin --url="$DATABASE_URL"
```

## Prisma Migrate
Expand Down
Loading