diff --git a/.github/workflows/scripts/generate-redirects.sh b/.github/workflows/scripts/generate-redirects.sh index 46ca459fef..990e734f66 100644 --- a/.github/workflows/scripts/generate-redirects.sh +++ b/.github/workflows/scripts/generate-redirects.sh @@ -30,14 +30,19 @@ do body="$body""\`\`\`%0A" fi - # name pieces + # name pieces (and replace `/index` from files (to get to a filename that would be equivalent)) action=${values[0]} - path1=${values[1]} - path2=${values[3]} + path1=$(echo "${values[1]}" | sed -e 's#/index##g' ) + path2=$(echo "${values[3]}" | sed -e 's#/index##g' ) + + # Skip if file names are identical (probably via `/index` replacement above) + if [[ "$path1" == "$path2" ]]; then + continue + fi # clean paths - path1_cleaned=$(echo "$path1" | sed -E 's:content/:/:g' | sed -E 's:/index.mdx::g' | sed -e 's/.mdx//g' | sed -E 's:/[0-9]+-:/:g' ) - path2_cleaned=$(echo "$path2" | sed -E 's:content/:/:g' | sed -E 's:/index.mdx::g' | sed -e 's/.mdx//g' | sed -E 's:/[0-9]+-:/:g' ) + path1_cleaned=$(echo "$path1" | sed -E 's:content/:/:g' | sed -e 's/.mdx//g' | sed -E 's:/[0-9]+-:/:g' ) + path2_cleaned=$(echo "$path2" | sed -E 's:content/:/:g' | sed -e 's/.mdx//g' | sed -E 's:/[0-9]+-:/:g' ) # special case for deletion if [[ "${values[0]}" == "D" ]]; then diff --git a/content/200-concepts/100-components/02-prisma-client/000-working-with-prismaclient/010-generating-prisma-client.mdx b/content/200-concepts/100-components/02-prisma-client/000-working-with-prismaclient/010-generating-prisma-client.mdx index 0e188036ea..33a1eb0c41 100644 --- a/content/200-concepts/100-components/02-prisma-client/000-working-with-prismaclient/010-generating-prisma-client.mdx +++ b/content/200-concepts/100-components/02-prisma-client/000-working-with-prismaclient/010-generating-prisma-client.mdx @@ -10,7 +10,7 @@ Prisma Client is an auto-generated database client that's tailored to your datab To generate and instantiate Prisma Client: -1. Ensure that you have [Prisma CLI installed on your machine](/concepts/components/prisma-cli/installation). +1. Ensure that you have [Prisma CLI installed on your machine](/reference/api-reference/command-reference#installation). 1. Add the following `generator` definition to your Prisma schema: diff --git a/content/200-concepts/100-components/02-prisma-client/index.mdx b/content/200-concepts/100-components/02-prisma-client/index.mdx index b1b0134cf4..191c3726e3 100644 --- a/content/200-concepts/100-components/02-prisma-client/index.mdx +++ b/content/200-concepts/100-components/02-prisma-client/index.mdx @@ -57,7 +57,7 @@ model User { } ``` -Also make sure to [install the Prisma CLI](/concepts/components/prisma-cli/installation): +Also make sure to [install the Prisma CLI](/reference/api-reference/command-reference#installation): ``` npm install prisma --save-dev diff --git a/content/200-concepts/100-components/03-prisma-migrate/100-legacy-migrate.mdx b/content/200-concepts/100-components/03-prisma-migrate/100-legacy-migrate.mdx index 5d4fa8e20f..bd4ca8b08b 100644 --- a/content/200-concepts/100-components/03-prisma-migrate/100-legacy-migrate.mdx +++ b/content/200-concepts/100-components/03-prisma-migrate/100-legacy-migrate.mdx @@ -10,7 +10,7 @@ hidePage: true > **Important!** This page documents legacy Prisma Migrate (Experimental) available in version 2.12.0 and earlier. [Prisma Migrate](.) is available in version [2.13.0](https://github.com/prisma/prisma/releases/tag/2.13.0) and Generally Available in [2.19.0](https://github.com/prisma/prisma/releases/tag/2.19.0). -Legacy Prisma Migrate is a tool that lets you _change your database schema_, e.g. by creating new tables or adding columns to existing tables. These changes are called _schema migrations_. legacy Prisma Migrate is available as part of the [Prisma CLI](/concepts/components/prisma-cli/installation) via the `legacy Prisma Migrate` command. +Legacy Prisma Migrate is a tool that lets you _change your database schema_, e.g. by creating new tables or adding columns to existing tables. These changes are called _schema migrations_. legacy Prisma Migrate is available as part of the [Prisma CLI](/reference/api-reference/command-reference#installation) via the `legacy Prisma Migrate` command. diff --git a/content/200-concepts/100-components/05-prisma-cli/index.mdx b/content/200-concepts/100-components/05-prisma-cli.mdx similarity index 100% rename from content/200-concepts/100-components/05-prisma-cli/index.mdx rename to content/200-concepts/100-components/05-prisma-cli.mdx diff --git a/content/200-concepts/100-components/05-prisma-cli/01-installation.mdx b/content/200-concepts/100-components/05-prisma-cli/01-installation.mdx deleted file mode 100644 index 2259d9339d..0000000000 --- a/content/200-concepts/100-components/05-prisma-cli/01-installation.mdx +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: 'Installing the Prisma CLI' -metaTitle: 'Prisma CLI Installation (Reference)' -metaDescription: '' ---- - - - -The Prisma CLI is available as an [npm package](https://www.npmjs.com/prisma). We **recommend that you install the Prisma CLI locally** in your project's `package.json` to avoid version conflicts. - -See [Prisma CLI command reference](/reference/api-reference/command-reference) for a complete list of commands. - - - -## Local installation (recommended) - -The Prisma CLI is typically installed as a **development dependency**, that's why the `--save-dev` (npm) and `--dev` (Yarn) options are used in the commands below. - -### npm - -Install with [npm](https://www.npmjs.com/): - -``` -npm install prisma --save-dev -``` - -This should add `prisma` to the `devDependencies` in your `package.json`. You can then invoke the locally installed CLI with the **`prisma`** command prefixed with [`npx`](https://github.com/npm/npx#readme): - -``` -npx prisma -``` - -Here's an example for invoking the `generate` command: - -``` -npx prisma generate -``` - -### Yarn (1.19.2+) - -Install with [Yarn](https://yarnpkg.com/): - -``` -yarn add prisma --dev -``` - -This should add `prisma` to the `devDependencies` in your `package.json`. You can then invoke the locally installed CLI with the **`prisma`** command prefixed with `yarn`: - -``` -yarn prisma -``` - -Here's an example for invoking the `generate` command: - -``` -yarn prisma generate -``` - - - -We recommend that you keep **both** the `prisma` and `@prisma/client` packages in sync to avoid any unexpected errors or behaviors. - - - -## Global installation (not recommended) - -While it is recommended to [locally install](#local-installation-recommended) the Prisma CLI, you can also install it globally on your machine. - -> **Warning**: If you have several Prisma projects on your machine, a global installation can lead to version conflicts between these projects. - -### npm - -Install with npm: - -``` -npm install -g prisma -``` - -You can then invoke the globally installed CLI with the **`prisma`** command like so: - -``` -prisma -``` - -Here's an example for invoking the `generate` command: - -``` -prisma generate -``` - -### Yarn - -Install with Yarn: - -``` -yarn global add prisma -``` - -You can then invoke the globally installed CLI with the **`prisma`** command like so: - -``` -prisma -``` - -Here's an example for invoking the `generate` command: - -``` -prisma generate -``` - -## Using a HTTP proxy for the CLI - -Prisma CLI supports [custom HTTP proxies](https://github.com/prisma/prisma/issues/506). This is particularly relevant when being behind a corporate firewall. - -To activate the proxy, provide the environment variables `HTTP_PROXY` and/or `HTTPS_PROXY`. The behavior is very similar to how the [`npm` CLI handles this](https://docs.npmjs.com/misc/config#https-proxy). - -The following environment variables can be provided: - -- [`HTTP_PROXY`](/reference/api-reference/environment-variables-reference#http_proxy) or `http_proxy`: Proxy URL for http traffic, for example `http://localhost:8080` -- [`HTTPS_PROXY`](/reference/api-reference/environment-variables-reference#https_proxy) or `https_proxy`: Proxy URL for https traffic, for example `https://localhost:8080` - -> To get a local proxy, you can also use the [`proxy`](https://www.npmjs.com/package/proxy) module. diff --git a/content/300-guides/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer.mdx b/content/300-guides/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer.mdx index e23fc2f381..6f0a8f193f 100644 --- a/content/300-guides/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer.mdx +++ b/content/300-guides/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer.mdx @@ -51,7 +51,7 @@ You can install the Prisma 2 CLI in your Node.js project as follows (be sure to npm install prisma --save-dev ``` -> **Note**: With Prisma 1, it was usually recommended to install the CLI globally. We now recommend to [install the Prisma CLI locally](/concepts/components/prisma-cli/installation#local-installation-recommended) to prevent version conflicts. +> **Note**: With Prisma 1, it was usually recommended to install the CLI globally. We now recommend to [install the Prisma CLI locally](/reference/api-reference/command-reference#installation#local-installation-recommended) to prevent version conflicts. You can now use the local installation of the `prisma` CLI by prefixing it with `npx`: diff --git a/content/300-guides/400-migrate-to-prisma/01-migrate-from-typeorm.mdx b/content/300-guides/400-migrate-to-prisma/01-migrate-from-typeorm.mdx index 9080934bd5..b8e96dc084 100644 --- a/content/300-guides/400-migrate-to-prisma/01-migrate-from-typeorm.mdx +++ b/content/300-guides/400-migrate-to-prisma/01-migrate-from-typeorm.mdx @@ -240,7 +240,7 @@ As mentioned before, this guide is an extended variation of the TypeORM Express ## Step 1. Install the Prisma CLI -The first step to adopt Prisma is to [install the Prisma CLI](/concepts/components/prisma-cli/installation#local-installation-recommended) in your project: +The first step to adopt Prisma is to [install the Prisma CLI](/reference/api-reference/command-reference#installation#local-installation-recommended) in your project: ```terminal copy npm install prisma --save-dev diff --git a/content/300-guides/400-migrate-to-prisma/02-migrate-from-sequelize.mdx b/content/300-guides/400-migrate-to-prisma/02-migrate-from-sequelize.mdx index 6aca6908d8..4bd7123f98 100644 --- a/content/300-guides/400-migrate-to-prisma/02-migrate-from-sequelize.mdx +++ b/content/300-guides/400-migrate-to-prisma/02-migrate-from-sequelize.mdx @@ -172,7 +172,7 @@ In this guide, the route handlers are located in the `src/controllers` directory ## Step 1. Install the Prisma CLI -The first step to adopt Prisma is to [install the Prisma CLI](/concepts/components/prisma-cli/installation#local-installation-recommended) in your project: +The first step to adopt Prisma is to [install the Prisma CLI](/reference/api-reference/command-reference#installation#local-installation-recommended) in your project: ```terminal copy npm install prisma --save-dev diff --git a/content/300-guides/400-migrate-to-prisma/03-migrate-from-mongoose.mdx b/content/300-guides/400-migrate-to-prisma/03-migrate-from-mongoose.mdx index 8dfe43c44e..a8182a2bbc 100644 --- a/content/300-guides/400-migrate-to-prisma/03-migrate-from-mongoose.mdx +++ b/content/300-guides/400-migrate-to-prisma/03-migrate-from-mongoose.mdx @@ -16,7 +16,7 @@ You can learn how Prisma compares to Mongoose on the [Prisma vs Mongoose](/conce Note that the steps for migrating from Mongoose to Prisma are always the same, no matter what kind of application or API layer you're building: -1. [Install the Prisma CLI](/concepts/components/prisma-cli/installation) +1. [Install the Prisma CLI](/reference/api-reference/command-reference#installation) 1. [Introspect your database](/concepts/components/introspection) 1. [Install Prisma Client](/concepts/components/prisma-client#2-installation) 1. Gradually replace your Mongoose queries with Prisma Client @@ -147,7 +147,7 @@ Run `npm run seed` to populate your database with the sample data in the `./src/ ## Step 1. Install the Prisma CLI -The first step to adopt Prisma is to [install the Prisma CLI](/concepts/components/prisma-cli/installation#local-installation-recommended) in your project: +The first step to adopt Prisma is to [install the Prisma CLI](/reference/api-reference/command-reference#installation#local-installation-recommended) in your project: ```terminal copy npm install prisma --save-dev 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 5f3475231c..a62ef8d763 100644 --- a/content/400-reference/200-api-reference/200-command-reference.mdx +++ b/content/400-reference/200-api-reference/200-command-reference.mdx @@ -11,9 +11,72 @@ This document describes the Prisma CLI commands, arguments, and options. +## Installation + +The Prisma CLI is typically installed locally as a **development dependency**, that's why the `--save-dev` (npm) and `--dev` (Yarn) options are used in the commands below. + + + +We **recommend that you install the Prisma CLI locally** in your project's `package.json` to avoid version conflicts that can happen with a global installation. + + + +### npm + +Install with [npm](https://www.npmjs.com/): + +``` +npm install prisma --save-dev +``` + +### Yarn + +Install with [yarn](https://yarnpkg.dev/): + +``` +yarn add prisma --save-dev +``` + +### pnpm + +Install with [pnpm](https://pnpm.io/): + +``` +pnpm install prisma --save-dev +``` + +
+Global installation (Not recommended) + +- **npm** + +Install with npm: + +``` +npm install -g prisma +``` + +- **Yarn** + +Install with Yarn: + +``` +yarn global add prisma +``` + +- **pnpm** + +Install with pnpm: + +``` +pnpm install prisma --global +``` + +
+ ## Usage -If you installed Prisma with a package manager, you need to prefix the `prisma` command with your package runner. +If you installed Prisma as a development dependency, you need to prefix the `prisma` command with your package runner. ### npm @@ -1321,3 +1384,12 @@ See [Seeding your database](/guides/migrate/seed-database) < ``` This is available from version 3.0.1 and later. + +## Using a HTTP proxy for the CLI + +Prisma CLI supports [custom HTTP proxies](https://github.com/prisma/prisma/issues/506). This is particularly relevant when being behind a corporate firewall. + +To activate usage of the proxy, provide either of the following environment variables: + +- [`HTTP_PROXY`](/reference/api-reference/environment-variables-reference#http_proxy) or `http_proxy`: Proxy URL for http traffic, for example `http://localhost:8080` +- [`HTTPS_PROXY`](/reference/api-reference/environment-variables-reference#https_proxy) or `https_proxy`: Proxy URL for https traffic, for example `https://localhost:8080` diff --git a/content/400-reference/200-api-reference/300-environment-variables-reference.mdx b/content/400-reference/200-api-reference/300-environment-variables-reference.mdx index 2b0ceb3608..cff68cac03 100644 --- a/content/400-reference/200-api-reference/300-environment-variables-reference.mdx +++ b/content/400-reference/200-api-reference/300-environment-variables-reference.mdx @@ -74,7 +74,7 @@ To configure `prisma generate` to [generate a Prisma Client for Data Proxy](/dat ## Proxy environment variables -The Prisma CLI supports custom HTTP(S) proxies to download the Prisma engines. These can be helpful to use when working behind a corporate firewall. See [Using a HTTP proxy for the CLI](/concepts/components/prisma-cli/installation#using-a-http-proxy-for-the-cli) for more information. +The Prisma CLI supports custom HTTP(S) proxies to download the Prisma engines. These can be helpful to use when working behind a corporate firewall. See [Using a HTTP proxy for the CLI](/reference/api-reference/command-reference#installation#using-a-http-proxy-for-the-cli) for more information. ### NO_PROXY diff --git a/content/800-data-platform/050-data-proxy/700-prisma-cli-with-data-proxy.mdx b/content/800-data-platform/050-data-proxy/700-prisma-cli-with-data-proxy.mdx index 8d875099dc..571b07d405 100644 --- a/content/800-data-platform/050-data-proxy/700-prisma-cli-with-data-proxy.mdx +++ b/content/800-data-platform/050-data-proxy/700-prisma-cli-with-data-proxy.mdx @@ -52,7 +52,7 @@ datasource db { `prisma studio` currently doesn't support the `directUrl` property. - + Then add the `DIRECT_URL` environment variable to your [`.env` file](/guides/development-environment/environment-variables#using-env-files): diff --git a/vercel.json b/vercel.json index f98a6eaafd..7290fe7d1d 100644 --- a/vercel.json +++ b/vercel.json @@ -1302,6 +1302,10 @@ { "source": "/docs/guides/database/advanced-database-tasks", "destination": "/docs/guides/other/advanced-database-tasks" + }, + { + "source": "/docs/concepts/components/prisma-cli/installation", + "destination": "/docs/reference/api-reference/command-reference#installation" } ] }