From 0d48cc0f070d8c3aeb98fd635f74e10a53bb307f Mon Sep 17 00:00:00 2001 From: ruheni Date: Fri, 27 Oct 2023 15:21:51 +0200 Subject: [PATCH 1/9] add example on how to use `prisma init --preview-feature` --- .../200-command-reference.mdx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/content/400-reference/200-api-reference/200-command-reference.mdx b/content/400-reference/200-api-reference/200-command-reference.mdx index b40edadfdc..2f24035c38 100644 --- a/content/400-reference/200-api-reference/200-command-reference.mdx +++ b/content/400-reference/200-api-reference/200-command-reference.mdx @@ -307,11 +307,11 @@ 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) | | +| `--preview-feature` | 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` | #### Examples @@ -356,6 +356,20 @@ 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` + +```terminal +prisma init --preview-feature multiSchema +``` + +The command sets `multiSchema` as a default Preview feature in your schema. + +```terminal +prisma init --preview-feature multischema --preview-feature metrics +``` + +The command sets `multiSchema` and `metrics` as the default Preview features in your Prisma schema. + #### Generated Assets **`prisma/schema.prisma`** From f66d594c1b77b0e1c8da64ada04157b13e58d9a4 Mon Sep 17 00:00:00 2001 From: ruheni Date: Fri, 27 Oct 2023 15:27:17 +0200 Subject: [PATCH 2/9] update description --- .../200-api-reference/200-command-reference.mdx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/400-reference/200-api-reference/200-command-reference.mdx b/content/400-reference/200-api-reference/200-command-reference.mdx index 2f24035c38..898eda1f95 100644 --- a/content/400-reference/200-api-reference/200-command-reference.mdx +++ b/content/400-reference/200-api-reference/200-command-reference.mdx @@ -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-feature` | 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 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-feature` | No | Define the default Preview features to use. [Learn more](/concepts/components/preview-features). 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 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` | #### Examples From 763a3db58819594c93f58c18767e992084f93b8b Mon Sep 17 00:00:00 2001 From: Alex Ruheni <33921841+ruheni@users.noreply.github.com> Date: Fri, 27 Oct 2023 15:16:21 +0100 Subject: [PATCH 3/9] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Joël Galeran --- .../200-api-reference/200-command-reference.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/400-reference/200-api-reference/200-command-reference.mdx b/content/400-reference/200-api-reference/200-command-reference.mdx index 898eda1f95..af5fc07738 100644 --- a/content/400-reference/200-api-reference/200-command-reference.mdx +++ b/content/400-reference/200-api-reference/200-command-reference.mdx @@ -308,11 +308,11 @@ The `init` command does not interpret any existing files. Instead, it creates a | 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` | +| `--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 default generator provider to use. | `prisma-client-js` | -| `--preview-feature` | No | Define the default Preview features to use. [Learn more](/concepts/components/preview-features). 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 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` | +| `--generator-provider` | No | Define the generator provider to use. | `prisma-client-js` | +| `--preview-feature` | No | Define the Preview features to use. [Learn more](/concepts/components/preview-features). 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. [Learn more](/concepts/components/prisma-client/working-with-prismaclient/generating-prisma-client#using-a-custom-output-path) | `node_modules/.prisma/client` | #### Examples @@ -362,13 +362,13 @@ The command output contains helpful information on how to use the generated file prisma init --preview-feature multiSchema ``` -The command sets `multiSchema` as a default Preview feature in your schema. +The command sets `multiSchema` as a Preview feature in your schema. ```terminal prisma init --preview-feature multischema --preview-feature metrics ``` -The command sets `multiSchema` and `metrics` as the default Preview features in your Prisma schema. +The command sets `multiSchema` and `metrics` as the Preview features in your Prisma schema. #### Generated Assets From a66fb1427e39a198b2bb284bf74f3105e682a908 Mon Sep 17 00:00:00 2001 From: Alex Ruheni <33921841+ruheni@users.noreply.github.com> Date: Fri, 27 Oct 2023 15:19:16 +0100 Subject: [PATCH 4/9] Update content/400-reference/200-api-reference/200-command-reference.mdx --- .../200-api-reference/200-command-reference.mdx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/400-reference/200-api-reference/200-command-reference.mdx b/content/400-reference/200-api-reference/200-command-reference.mdx index af5fc07738..092f0adda6 100644 --- a/content/400-reference/200-api-reference/200-command-reference.mdx +++ b/content/400-reference/200-api-reference/200-command-reference.mdx @@ -306,14 +306,15 @@ The `init` command does not interpret any existing files. Instead, it creates a #### Arguments -| Argument | Required | Description | Default | -| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------- | +| 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. | | +| `--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 to use. [Learn more](/concepts/components/preview-features). 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. [Learn more](/concepts/components/prisma-client/working-with-prismaclient/generating-prisma-client#using-a-custom-output-path) | `node_modules/.prisma/client` | + #### Examples ##### Run `prisma init` From 42b6580aa983b68e8ed5720d924db05ce47c14e9 Mon Sep 17 00:00:00 2001 From: Alex Ruheni <33921841+ruheni@users.noreply.github.com> Date: Fri, 27 Oct 2023 22:51:43 +0100 Subject: [PATCH 5/9] Apply suggestions from code review Co-authored-by: Jan Piotrowski Co-authored-by: Jon Harrell <4829245+jharrell@users.noreply.github.com> --- .../200-api-reference/200-command-reference.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/400-reference/200-api-reference/200-command-reference.mdx b/content/400-reference/200-api-reference/200-command-reference.mdx index 092f0adda6..55df032cec 100644 --- a/content/400-reference/200-api-reference/200-command-reference.mdx +++ b/content/400-reference/200-api-reference/200-command-reference.mdx @@ -311,8 +311,8 @@ The `init` command does not interpret any existing files. Instead, it creates a | `--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 to use. [Learn more](/concepts/components/preview-features). 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. [Learn more](/concepts/components/prisma-client/working-with-prismaclient/generating-prisma-client#using-a-custom-output-path) | `node_modules/.prisma/client` | +| `--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 @@ -366,7 +366,7 @@ prisma init --preview-feature multiSchema The command sets `multiSchema` as a Preview feature in your schema. ```terminal -prisma init --preview-feature multischema --preview-feature metrics +prisma init --preview-feature multiSchema --preview-feature metrics ``` The command sets `multiSchema` and `metrics` as the Preview features in your Prisma schema. From 0a4deb259493dad8c515db5b501cdf9af5cec4ce Mon Sep 17 00:00:00 2001 From: Alex Ruheni <33921841+ruheni@users.noreply.github.com> Date: Fri, 27 Oct 2023 22:52:37 +0100 Subject: [PATCH 6/9] Update content/400-reference/200-api-reference/200-command-reference.mdx --- .../200-api-reference/200-command-reference.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/400-reference/200-api-reference/200-command-reference.mdx b/content/400-reference/200-api-reference/200-command-reference.mdx index 55df032cec..ef3b56dc94 100644 --- a/content/400-reference/200-api-reference/200-command-reference.mdx +++ b/content/400-reference/200-api-reference/200-command-reference.mdx @@ -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 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` | +| 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` | +| `--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 From 0571073bc7e4f0f6c58dc40ad1940811749d7513 Mon Sep 17 00:00:00 2001 From: ruheni Date: Mon, 30 Oct 2023 15:09:41 +0100 Subject: [PATCH 7/9] add output example --- .../200-command-reference.mdx | 49 ++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/content/400-reference/200-api-reference/200-command-reference.mdx b/content/400-reference/200-api-reference/200-command-reference.mdx index ef3b56dc94..56b52dd502 100644 --- a/content/400-reference/200-api-reference/200-command-reference.mdx +++ b/content/400-reference/200-api-reference/200-command-reference.mdx @@ -307,14 +307,13 @@ The `init` command does not interpret any existing files. Instead, it creates a #### Arguments | 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 ##### Run `prisma init` @@ -359,17 +358,55 @@ The command output contains helpful information on how to use the generated file #### Run `prisma init --preview-feature` -```terminal -prisma init --preview-feature multiSchema + + +```terminal prisma init --preview-feature multiSchema ``` + + + +```prisma +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} + +generator client { + provider = "prisma-client-js" + previewFeatures = ["multiSchema"] +} ``` -The command sets `multiSchema` as a Preview feature in your schema. + + + + + + + ```terminal prisma init --preview-feature multiSchema --preview-feature metrics ``` -The command sets `multiSchema` and `metrics` as the Preview features in your Prisma schema. + + + + +```prisma +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} + +generator client { + provider = "prisma-client-js" + previewFeatures = ["multiSchema", "metrics"] +} +``` + + + + #### Generated Assets From 4a964bfa0fcafa372f295bb995a2c81714b7caa6 Mon Sep 17 00:00:00 2001 From: Alex Ruheni <33921841+ruheni@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:10:00 +0000 Subject: [PATCH 8/9] Apply suggestions from code review Co-authored-by: Jan Piotrowski --- .../400-reference/200-api-reference/200-command-reference.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/400-reference/200-api-reference/200-command-reference.mdx b/content/400-reference/200-api-reference/200-command-reference.mdx index 56b52dd502..6ce71ce525 100644 --- a/content/400-reference/200-api-reference/200-command-reference.mdx +++ b/content/400-reference/200-api-reference/200-command-reference.mdx @@ -311,7 +311,7 @@ The `init` command does not interpret any existing files. Instead, it creates a | `--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) | | +| `--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 From 2b433f2cb9ceb416c757c4b0e703227bf9f39b28 Mon Sep 17 00:00:00 2001 From: ruheni Date: Mon, 30 Oct 2023 15:10:28 +0100 Subject: [PATCH 9/9] format table --- .../200-api-reference/200-command-reference.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/content/400-reference/200-api-reference/200-command-reference.mdx b/content/400-reference/200-api-reference/200-command-reference.mdx index 6ce71ce525..f66b48785e 100644 --- a/content/400-reference/200-api-reference/200-command-reference.mdx +++ b/content/400-reference/200-api-reference/200-command-reference.mdx @@ -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 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` | +| 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` | +| `--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 @@ -360,7 +360,7 @@ The command output contains helpful information on how to use the generated file -```terminal prisma init --preview-feature multiSchema ``` +```terminal prisma init --preview-feature multiSchema``` @@ -1049,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