diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection.mdx index 6c07af1689..6da336000e 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection.mdx @@ -140,7 +140,7 @@ As a next step, you will introspect your database. The result of the introspecti Run the following command to introspect your database: ```terminal copy -npx prisma introspect +npx prisma db pull ``` This commands reads the `DATABASE_URL` environment variable that's defined in `.env` and connects to your database. Once the connection is established, it introspects the database (i.e. it _reads the database schema_). It then translates the database schema from SQL into a Prisma data model. diff --git a/content/200-concepts/050-overview/100-what-is-prisma/100-data-modeling.mdx b/content/200-concepts/050-overview/100-what-is-prisma/100-data-modeling.mdx index 9dbfedfa11..48f8da3a7c 100644 --- a/content/200-concepts/050-overview/100-what-is-prisma/100-data-modeling.mdx +++ b/content/200-concepts/050-overview/100-what-is-prisma/100-data-modeling.mdx @@ -233,7 +233,7 @@ When using only Prisma Client and _not_ using Prisma Migrate in your application Here is an overview of the main workflow: 1. Change your database schema using SQL (e.g. `CREATE TABLE`, `ALTER TABLE`, ...) -1. Run `prisma introspect` to introspect the database and add application models to the Prisma schema +1. Run `prisma db pull` to introspect the database and add application models to the Prisma schema 1. Run `prisma generate` to update your Prisma Client API ### Using Prisma Client and Prisma Migrate diff --git a/content/200-concepts/050-overview/300-prisma-in-your-stack/03-is-prisma-an-orm.mdx b/content/200-concepts/050-overview/300-prisma-in-your-stack/03-is-prisma-an-orm.mdx index cee7d7bf33..ee8040aa2d 100644 --- a/content/200-concepts/050-overview/300-prisma-in-your-stack/03-is-prisma-an-orm.mdx +++ b/content/200-concepts/050-overview/300-prisma-in-your-stack/03-is-prisma-an-orm.mdx @@ -310,7 +310,7 @@ generator client { } ``` -2. Run `prisma introspect` to populate the Prisma schema with models derived from your database schema. +2. Run `prisma db pull` to populate the Prisma schema with models derived from your database schema. 3. (Optional) Customize [field and model mappings](../../components/prisma-schema/data-model#mapping-model-names-to-tables-or-collections) between Prisma Client and the database. 4. Run `prisma generate`. diff --git a/content/200-concepts/100-components/01-prisma-schema/index.mdx b/content/200-concepts/100-components/01-prisma-schema/index.mdx index e767205ede..aa32de1a9b 100644 --- a/content/200-concepts/100-components/01-prisma-schema/index.mdx +++ b/content/200-concepts/100-components/01-prisma-schema/index.mdx @@ -168,7 +168,7 @@ The Prisma CLI looks for the Prisma schema file in the following locations, in t - `./prisma/schema.prisma` - `./schema.prisma` -The Prisma CLI outputs the path of the schema file that will be used. The following example shows the terminal output for `prisma introspect`: +The Prisma CLI outputs the path of the schema file that will be used. The following example shows the terminal output for `prisma db pull`: ```no-lines Environment variables loaded from prisma/.env diff --git a/content/200-concepts/100-components/02-prisma-client/000-working-with-prismaclient/020-use-custom-model-and-field-names.mdx b/content/200-concepts/100-components/02-prisma-client/000-working-with-prismaclient/020-use-custom-model-and-field-names.mdx index a15e091782..ca4ee65ef9 100644 --- a/content/200-concepts/100-components/02-prisma-client/000-working-with-prismaclient/020-use-custom-model-and-field-names.mdx +++ b/content/200-concepts/100-components/02-prisma-client/000-working-with-prismaclient/020-use-custom-model-and-field-names.mdx @@ -188,7 +188,7 @@ In both cases, `user_id` is used to refer to an _entire_ "user object", not only You can "rename" fields and models that are used in the Prisma Client by mapping them to the "original" names in the database using the `@map` and `@@map` attributes. For the [example](#example) above, you could e.g. annotate your models as follows to prevent the mentioned issues. -_After_ you introspected your database with `prisma introspect`, you can manually adjust the resulting Prisma schema as follows: +_After_ you introspected your database with `prisma db pull`, you can manually adjust the resulting Prisma schema as follows: ```prisma model Category { diff --git a/content/200-concepts/100-components/04-introspection.mdx b/content/200-concepts/100-components/04-introspection.mdx index 8f98b9933a..631252f992 100644 --- a/content/200-concepts/100-components/04-introspection.mdx +++ b/content/200-concepts/100-components/04-introspection.mdx @@ -40,11 +40,11 @@ You can learn more about how Prisma maps types from the database to the types av - [MySQL](../database-connectors/mysql) - [SQLite](../database-connectors/sqlite) -## The `prisma introspect` command +## The `prisma db pull` command -You can introspect your database using the `prisma introspect` command of the [Prisma CLI](prisma-cli/installation). Note that using this command requires your [connection URL](../../reference/database-reference/connection-urls) to be set in your Prisma schema! +You can introspect your database using the `prisma db pull` command of the [Prisma CLI](prisma-cli/installation). Note that using this command requires your [connection URL](../../reference/database-reference/connection-urls) to be set in your Prisma schema! -Here's a high-level overview of the steps that `prisma introspect` performs internally: +Here's a high-level overview of the steps that `prisma db pull` performs internally: 1. Read the [connection URL](../../reference/database-reference/connection-urls) from the `datasource` configuration in the Prisma schema 1. Open database connection @@ -54,7 +54,7 @@ Here's a high-level overview of the steps that `prisma introspect` performs inte ## Introspection with an existing schema -In version 2.6.0 and later, running `prisma introspect` with an existing schema merges manual changes made to the schema with changes made in the database. Introspection maintains the following manual changes: +In version 2.6.0 and later, running `prisma db pull` with an existing schema merges manual changes made to the schema with changes made in the database. Introspection maintains the following manual changes: - Order of `model` blocks - Order of `enum` blocks @@ -76,10 +76,10 @@ The following properties of the schema are determined by the database: ### Force overwrite -To overwrite manual changes, generate a schema based solely on the introspected database and ignore any existing schema file, add the `--force` flag to the `introspect` command: +To overwrite manual changes, generate a schema based solely on the introspected database and ignore any existing schema file, add the `--force` flag to the `db pull` command: ```terminal -npx prisma introspect --force +npx prisma db pull --force ``` Use cases include: @@ -92,7 +92,7 @@ Use cases include: The typical workflow for projects that are not using Prisma Migrate, but instead use plain SQL or another migration tool looks as follows: 1. Change the database schema (e.g. using plain SQL) -1. Run `prisma introspect` to update the Prisma schema +1. Run `prisma db pull` to update the Prisma schema 1. Run `prisma generate` to update Prisma Client 1. Use the updated Prisma Client in your application @@ -318,4 +318,4 @@ Introspecting only a subset of your database schema is [not yet officially suppo However, you can achieve this by creating a new database user that only has access to the tables which you'd like to see represented in your Prisma schema, and then perform the introspection using that user. The introspection will then only include the tables the new user has access to. -If your goal is to exclude certain models from the [Prisma Client generation](prisma-client/working-with-prismaclient/generating-prisma-client), you can also manually delete the models that should be excluded from your Prisma schema. Note however that they will be added again when you run `prisma introspect`. +If your goal is to exclude certain models from the [Prisma Client generation](prisma-client/working-with-prismaclient/generating-prisma-client), you can also manually delete the models that should be excluded from your Prisma schema. Note however that they will be added again when you run `prisma db pull`. diff --git a/content/200-concepts/100-components/250-preview-features/100-sql-server/001-sql-server-start-from-scratch.mdx b/content/200-concepts/100-components/250-preview-features/100-sql-server/001-sql-server-start-from-scratch.mdx index faa60bf805..88c5098487 100644 --- a/content/200-concepts/100-components/250-preview-features/100-sql-server/001-sql-server-start-from-scratch.mdx +++ b/content/200-concepts/100-components/250-preview-features/100-sql-server/001-sql-server-start-from-scratch.mdx @@ -173,7 +173,7 @@ To connect to your Microsoft SQL Server database: ```terminal - npx prisma introspect + npx prisma db pull ``` @@ -356,7 +356,7 @@ As a next step, you will introspect your database. The result of the introspecti 1. Run the following command to introspect your database: ```terminal copy - npx prisma introspect + npx prisma db pull ``` 2. Open `prisma.schema` to see your data model: diff --git a/content/300-guides/050-database/100-developing-with-prisma-migrate/050-add-prisma-migrate-to-a-project.mdx b/content/300-guides/050-database/100-developing-with-prisma-migrate/050-add-prisma-migrate-to-a-project.mdx index 5cb374fe81..01ab632ad0 100644 --- a/content/300-guides/050-database/100-developing-with-prisma-migrate/050-add-prisma-migrate-to-a-project.mdx +++ b/content/300-guides/050-database/100-developing-with-prisma-migrate/050-add-prisma-migrate-to-a-project.mdx @@ -30,7 +30,7 @@ Make sure your Prisma schema is in sync with your database schema. This should a 1. Introspect the database to make sure that your Prisma schema is up-to-date: ```terminal - prisma introspect + prisma db pull ``` ### Initialize migration history diff --git a/content/300-guides/050-database/100-developing-with-prisma-migrate/200-troubleshooting-development.mdx b/content/300-guides/050-database/100-developing-with-prisma-migrate/200-troubleshooting-development.mdx index 511912c274..cff2cbccb8 100644 --- a/content/300-guides/050-database/100-developing-with-prisma-migrate/200-troubleshooting-development.mdx +++ b/content/300-guides/050-database/100-developing-with-prisma-migrate/200-troubleshooting-development.mdx @@ -69,7 +69,7 @@ If you made manual changes to the database that you want to keep, you can: 1. Introspect the database: ```terminal - npx prisma introspect + npx prisma db pull ``` Prisma will update your schema with the changes made directly in the database. diff --git a/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/01-postgresql.mdx b/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/01-postgresql.mdx index 74437d9bc2..6b654898a6 100644 --- a/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/01-postgresql.mdx +++ b/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/01-postgresql.mdx @@ -302,7 +302,7 @@ DATABASE_URL=postgresql://janedoe:mypassword@localhost:5432/CascadingDeletesDemo With both the `schema.prisma` and `.env` files in place, you can run Prisma's introspection with the following command: ``` -npx prisma introspect +npx prisma db pull ``` This command introspects your database and for each table adds a Prisma model to the Prisma schema: diff --git a/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/02-mysql.mdx b/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/02-mysql.mdx index 74a1190ab7..7c8c873bee 100644 --- a/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/02-mysql.mdx +++ b/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/02-mysql.mdx @@ -295,7 +295,7 @@ DATABASE_URL=mysql://janedoe:mypassword@localhost:3306/CascadingDeletesDemo With both the `schema.prisma` and `.env` files in place, you can run Prisma's introspection with the following command: ``` -npx prisma introspect +npx prisma db pull ``` This command introspects your database and for each table adds a Prisma model to the Prisma schema: diff --git a/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/03-sqlite.mdx b/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/03-sqlite.mdx index 0f7d224a8f..5ad450b223 100644 --- a/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/03-sqlite.mdx +++ b/content/300-guides/050-database/900-advanced-database-tasks/06-cascading-deletes/03-sqlite.mdx @@ -296,7 +296,7 @@ DATABASE_URL=file:CascadingDeletesDemo.db With both the `schema.prisma` and `.env` files in place, you can run Prisma's introspection with the following command: ``` -npx prisma introspect +npx prisma db pull ``` This command introspects your database and for each table adds a Prisma model to the Prisma schema: diff --git a/content/300-guides/050-database/900-advanced-database-tasks/07-data-validation/01-postgresql.mdx b/content/300-guides/050-database/900-advanced-database-tasks/07-data-validation/01-postgresql.mdx index 8d2266d799..7718881149 100644 --- a/content/300-guides/050-database/900-advanced-database-tasks/07-data-validation/01-postgresql.mdx +++ b/content/300-guides/050-database/900-advanced-database-tasks/07-data-validation/01-postgresql.mdx @@ -280,7 +280,7 @@ DATABASE_URL=postgresql://janedoe:mypassword@localhost:5432/CheckDemo With both the `schema.prisma` and `.env` files in place, you can run Prisma's introspection with the following command: ``` -npx prisma introspect +npx prisma db pull ``` This command introspects your database and for each table adds a Prisma model to the Prisma schema: diff --git a/content/300-guides/050-database/900-advanced-database-tasks/08-sql-views.mdx b/content/300-guides/050-database/900-advanced-database-tasks/08-sql-views.mdx index a8f8a4bf76..5d2a16ad85 100644 --- a/content/300-guides/050-database/900-advanced-database-tasks/08-sql-views.mdx +++ b/content/300-guides/050-database/900-advanced-database-tasks/08-sql-views.mdx @@ -386,7 +386,7 @@ In this section you'll introspect your database to generate the Prisma models fo 4. With both the `schema.prisma` and `.env` files in place, run Prisma's introspection with the following command: ```terminal - npx prisma introspect + npx prisma db pull ``` This command introspects your database and for each table adds a Prisma model to the Prisma schema: diff --git a/content/300-guides/125-development-environment/050-environment-variables/100-managing-env-files-and-setting-variables.mdx b/content/300-guides/125-development-environment/050-environment-variables/100-managing-env-files-and-setting-variables.mdx index 351deef507..5701fdb40a 100644 --- a/content/300-guides/125-development-environment/050-environment-variables/100-managing-env-files-and-setting-variables.mdx +++ b/content/300-guides/125-development-environment/050-environment-variables/100-managing-env-files-and-setting-variables.mdx @@ -125,7 +125,7 @@ The following steps show how to use the `dotenv-cli` package to use an alternati 3. To use the `.env3` file, you can use `dotenv` when you run any Prisma command and specify which `.env` file to use. The following example uses a file named `.env3`: ``` - dotenv -e .env3 -- npx prisma introspect + dotenv -e .env3 -- npx prisma db pull ``` > **Note:** dotenv doesn't pass the flags to the Prisma command by default, this is why the command includes two dashes `--` before `prisma`, making it possible to use flags like `--force`, `--schema` or `--preview-feature`. diff --git a/content/300-guides/125-development-environment/050-environment-variables/index.mdx b/content/300-guides/125-development-environment/050-environment-variables/index.mdx index c9832729e6..7b85cbda38 100644 --- a/content/300-guides/125-development-environment/050-environment-variables/index.mdx +++ b/content/300-guides/125-development-environment/050-environment-variables/index.mdx @@ -63,7 +63,7 @@ The following table describes where the Prisma CLI looks for the `.env` file: | `prisma [command]` | `./prisma/schema.prisma` | `./.env`
`./prisma/.env` | | `prisma [command] --schema=./a/b/schema.prisma` | `./a/b/schema.prisma` | `./.env`
`./a/b/.env`
`./prisma/.env` | | `prisma [command]` | `"prisma": {"schema": "/path/to/schema.prisma"}` | `.env`
`./path/to/schema/.env`
`./prisma/.env` | -| `prisma [command]` | No schema (for example, when running `prisma introspect` in an empty directory) | `./.env`
`./prisma/.env` | +| `prisma [command]` | No schema (for example, when running `prisma db pull` in an empty directory) | `./.env`
`./prisma/.env` | Any environment variables defined in that `.env` file will automatically be loaded when running a Prisma CLI command. @@ -104,7 +104,7 @@ You can set the `DATABASE_URL` in your `.env` file: DATABASE_URL=postgresql://test:test@localhost:5432/test?schema=public ``` -When you run a command that needs access to the database defined via the `datasource` block (for example, `prisma introspect`), the Prisma CLI automatically loads the `DATABASE_URL` environment variables from the `.env` file and makes it available to the CLI. +When you run a command that needs access to the database defined via the `datasource` block (for example, `prisma db pull`), the Prisma CLI automatically loads the `DATABASE_URL` environment variables from the `.env` file and makes it available to the CLI. ### Using environment variables in your code diff --git a/content/300-guides/200-deployment/110-deployment-guides/400-deploying-to-aws-lambda.mdx b/content/300-guides/200-deployment/110-deployment-guides/400-deploying-to-aws-lambda.mdx index 4f8f9540dd..786db2ffad 100644 --- a/content/300-guides/200-deployment/110-deployment-guides/400-deploying-to-aws-lambda.mdx +++ b/content/300-guides/200-deployment/110-deployment-guides/400-deploying-to-aws-lambda.mdx @@ -50,7 +50,7 @@ Prisma supports different workflows depending on whether you integrate with an e This guide starts with an empty database created with plain SQL and looks as follows: 1. Define the database schema using SQL. -1. Run `prisma introspect` locally which will introspect and populate the `schema.prisma` with models based on the database schema. +1. Run `prisma db pull` locally which will introspect and populate the `schema.prisma` with models based on the database schema. 1. Run `prisma generate` which will generate Prisma Client based on the Prisma schema. ## 1. Download the example @@ -146,7 +146,7 @@ Congratulations, you have successfully created the database schema. Introspect the database with the Prisma CLI: ```terminal -npx prisma introspect +npx prisma db pull ``` Prisma will introspect the database defined in the `datasource` block of the Prisma schema and populate the Prisma schema with models corresponding to the database tables. diff --git a/content/300-guides/200-deployment/110-deployment-guides/500-deploying-to-netlify.mdx b/content/300-guides/200-deployment/110-deployment-guides/500-deploying-to-netlify.mdx index e396a5723c..52fd333d0b 100644 --- a/content/300-guides/200-deployment/110-deployment-guides/500-deploying-to-netlify.mdx +++ b/content/300-guides/200-deployment/110-deployment-guides/500-deploying-to-netlify.mdx @@ -43,7 +43,7 @@ Prisma supports different workflows depending on whether you integrate with an e This guide starts with an empty database created with plain SQL and looks as follows: 1. Define the database schema using SQL. -1. Run `prisma introspect` locally which will introspect and populate the `schema.prisma` with models based on the database schema. +1. Run `prisma db pull` locally which will introspect and populate the `schema.prisma` with models based on the database schema. 1. Run `prisma generate` which will generate Prisma Client based on the Prisma schema. ## 1. Fork the `deployment-example-netlify` repository @@ -127,7 +127,7 @@ Congratulations, you have successfully created the database schema. Introspect the database with the Prisma CLI: ```terminal -npx prisma introspect +npx prisma db pull ``` Prisma will introspect the database defined in the `datasource` block of the Prisma schema and populate the Prisma schema with models corresponding to the database tables. @@ -136,7 +136,7 @@ Prisma will introspect the database defined in the `datasource` block of the Pri ## 6. Commit the Prisma schema to the repository -The result of `prisma introspect` is the `schema.prisma` Prisma schema file. +The result of `prisma db pull` is the `schema.prisma` Prisma schema file. Since the Prisma schema is used to generate Prisma Client, commit it to your repository so that Prisma Client can be generated when Netlify builds the project: diff --git a/content/300-guides/300-upgrade-guides/300-upgrading-to-use-preview-features/050-enabling-named-constraints.mdx b/content/300-guides/300-upgrade-guides/300-upgrading-to-use-preview-features/050-enabling-named-constraints.mdx index a26367af30..798d28994f 100644 --- a/content/300-guides/300-upgrade-guides/300-upgrading-to-use-preview-features/050-enabling-named-constraints.mdx +++ b/content/300-guides/300-upgrade-guides/300-upgrading-to-use-preview-features/050-enabling-named-constraints.mdx @@ -40,7 +40,7 @@ Use the following guide if you use introspection only. 1. Introspect to populate your Prisma schema with any constraint names that do not follow Prisma's naming convention: ```terminal - npx prisma introspect + npx prisma db pull ``` For example, in the following model, the `@id` primary key constraint does not follow Prisma's convention (the conventional name would be `User_pk`): @@ -105,7 +105,7 @@ To keep existing names, run `prisma db pull` against the target environment with 1. Introspect your **development database** to populate the Prisma schema with constraint and index names in your underlying database _that do not match Prisma's naming convention_: ```terminal - npx prisma migrate introspect + npx prisma db pull ``` In this example, the highlighted constraints did not conform to Prisma's default naming convention and now include the `map` attribute field: diff --git a/content/300-guides/300-upgrade-guides/800-upgrade-from-prisma-1/01-how-to-upgrade.mdx b/content/300-guides/300-upgrade-guides/800-upgrade-from-prisma-1/01-how-to-upgrade.mdx index 7c2ec56af5..6f7a69b30f 100644 --- a/content/300-guides/300-upgrade-guides/800-upgrade-from-prisma-1/01-how-to-upgrade.mdx +++ b/content/300-guides/300-upgrade-guides/800-upgrade-from-prisma-1/01-how-to-upgrade.mdx @@ -88,7 +88,7 @@ On a high-level, the upgrade workflow using the Upgrade CLI looks as follows. For the **initial setup**: 1. You set up Prisma 2 by installing the Prisma 2 CLI and running `npx prisma init`. -1. You connect to your database and introspect it with `npx prisma introspect`. +1. You connect to your database and introspect it with `npx prisma db pull`. ![Prisma CLI introspection flow](https://imgur.com/UiJCG4L.png) @@ -97,7 +97,7 @@ For **fixing the schema incompatibilities**: 1. You invoke the Upgrade CLI with `npx prisma-upgrade`. 1. The Upgrade CLI generates SQL commands for you to run on your database. 1. You run the SQL commands against your database. -1. You run the `prisma introspect` command again. +1. You run the `prisma db pull` command again. 1. You run the `npx prisma-upgrade` command again. 1. The Upgrade CLI adjusts the Prisma 2 schema by adding missing attributes. 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 fd4ca3f7e5..afdbbd9922 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 @@ -522,7 +522,7 @@ These are the different steps of the upgrade process: 1. The Upgrade CLI generates SQL commands for you to run on your database. 2. You run the SQL commands against your database. - 3. You run the `npx prisma introspect` command again. + 3. You run the `npx prisma db pull` command again. 4. You run the `npx prisma-upgrade` command again. 5. The Upgrade CLI adjusts the Prisma 2 schema by adding missing attributes. @@ -961,7 +961,7 @@ After you executed one or more of the previous SQL statements against your datab please run the following two commands to refresh your Prisma 2 schema and check the changes. - 1. Run `npx prisma introspect` again to refresh your Prisma 2 schema. + 1. Run `npx prisma db pull` again to refresh your Prisma 2 schema. 2. Run `npx prisma-upgrade` again. If you can't or don't want to execute the remaining SQL statements right now, you can @@ -1016,7 +1016,7 @@ After you executed one or more of the above SQL statements against your database please run the following two commands to refresh your Prisma 2 Schema and check the changes. - 1. Run `npx prisma introspect` again to refresh your Prisma 2 schema. + 1. Run `npx prisma db pull` again to refresh your Prisma 2 schema. 2. Run `npx prisma-upgrade` again. If you can't or don't want to execute the remaining SQL statements right now, you can @@ -1057,7 +1057,7 @@ At this point, you've resolved the schema incompatibilities with the Upgrade CLI In this section, you'll update your Prisma schema with another introspection round. This time, the previous flaws of the Prisma schema will be resolved because the database schema has been adjusted: ```terminal copy -npx prisma introspect +npx prisma db pull ``` This time, the resulting Prisma schema looks as follows: @@ -1156,7 +1156,7 @@ After you executed one or more of the previous SQL statements against your datab please run the following two commands to refresh your Prisma 2 schema and check the changes. - 1. Run `npx prisma introspect` again to refresh your Prisma 2 schema. + 1. Run `npx prisma db pull` again to refresh your Prisma 2 schema. 2. Run `npx prisma-upgrade` again. If you can't or don't want to execute the remaining SQL statements right now, you can 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 0bc7c7b2c7..3131f09e3c 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 @@ -447,7 +447,7 @@ DATABASE_URL="file:./blog-typeorm.db" With your connection URL in place, you can [introspect](../../concepts/components/introspection) your database to generate your Prisma models: ```terminal copy -npx prisma introspect +npx prisma db pull ``` This creates the following Prisma models: 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 e165d64ca4..c976e43187 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 @@ -367,7 +367,7 @@ DATABASE_URL="file:./blog-sequelize.db" With your connection URL in place, you can [introspect](../../concepts/components/introspection) your database to generate your Prisma models: ```terminal copy -npx prisma introspect +npx prisma db pull ``` This creates the following Prisma models: diff --git a/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/01-postgresql.mdx b/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/01-postgresql.mdx index f21393c6b7..b0970203b8 100644 --- a/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/01-postgresql.mdx +++ b/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/01-postgresql.mdx @@ -234,7 +234,7 @@ Here's a short explanation of each component: With both the `schema.prisma` and `.env` files in place, you can run Prisma's introspection with the following command: ```terminal copy -npx prisma introspect +npx prisma db pull ``` This command introspects your database and for each table adds a Prisma model to the Prisma schema: diff --git a/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/02-mysql.mdx b/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/02-mysql.mdx index 9dcd53dd7a..9676b8f63e 100644 --- a/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/02-mysql.mdx +++ b/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/02-mysql.mdx @@ -236,7 +236,7 @@ DATABASE_URL=mysql://janedoe:mypassword@localhost:3306/UniqueDemo With both the `schema.prisma` and `.env` files in place, you can run Prisma's introspection with the following command: ``` -npx prisma introspect +npx prisma db pull ``` This command introspects your database and for each table adds a Prisma model to the Prisma schema: diff --git a/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/03-sqlite.mdx b/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/03-sqlite.mdx index 87fe358f69..8de1e08095 100644 --- a/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/03-sqlite.mdx +++ b/content/300-guides/600-general-guides/100-database-workflows/04-unique-constraints-and-indexes/03-sqlite.mdx @@ -151,7 +151,7 @@ DATABASE_URL=file:UniqueDemo.db With both the `schema.prisma` and `.env` files in place, you can run Prisma's introspection with the following command: ``` -npx prisma introspect +npx prisma db pull ``` This command introspects your database and for each table adds a Prisma model to the Prisma schema: diff --git a/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/01-postgresql.mdx b/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/01-postgresql.mdx index 5a52cc37c6..d8d3a41daf 100644 --- a/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/01-postgresql.mdx +++ b/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/01-postgresql.mdx @@ -166,7 +166,7 @@ DATABASE_URL=postgresql://janedoe:mypassword@localhost:5432/ForeignKeyDemo With both the `schema.prisma` and `.env` files in place, you can run Prisma's introspection with the following command: ``` -npx prisma introspect +npx prisma db pull ``` This command introspects your database and for each table adds a Prisma model to the Prisma schema: diff --git a/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/02-mysql.mdx b/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/02-mysql.mdx index 832a2d48fe..c31974178d 100644 --- a/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/02-mysql.mdx +++ b/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/02-mysql.mdx @@ -148,7 +148,7 @@ DATABASE_URL=mysql://janedoe:mypassword@localhost:3306/ForeignKeyDemo With both the `schema.prisma` and `.env` files in place, you can run Prisma's introspection with the following command: ``` -npx prisma introspect +npx prisma db pull ``` This command introspects your database and for each table adds a Prisma model to the Prisma schema: diff --git a/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/03-sqlite.mdx b/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/03-sqlite.mdx index 4d5bd91d19..0a9abeec89 100644 --- a/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/03-sqlite.mdx +++ b/content/300-guides/600-general-guides/100-database-workflows/05-foreign-keys/03-sqlite.mdx @@ -156,7 +156,7 @@ DATABASE_URL=file:../ForeignKeyDemo.db With both the `schema.prisma` and `.env` files in place, you can run Prisma's introspection with the following command: ``` -npx prisma introspect +npx prisma db pull ``` This command introspects your database and for each table adds a Prisma model to the Prisma schema: diff --git a/content/400-reference/200-api-reference/100-prisma-schema-reference.mdx b/content/400-reference/200-api-reference/100-prisma-schema-reference.mdx index c768cf1e3d..d0f3d68c5a 100644 --- a/content/400-reference/200-api-reference/100-prisma-schema-reference.mdx +++ b/content/400-reference/200-api-reference/100-prisma-schema-reference.mdx @@ -873,7 +873,7 @@ The [MongoDB connector](../../concepts/database-connectors/mongodb) does not cur -The `Unsupported` type was introduced in [2.17.0](https://github.com/prisma/prisma/releases/tag/2.17.0) and allows you to represent data types in the Prisma schema that are not supported by the Prisma Client. `Unsupported` fields can be introspected with `prisma introspect` or created with Prisma Migrate or `db push`. +The `Unsupported` type was introduced in [2.17.0](https://github.com/prisma/prisma/releases/tag/2.17.0) and allows you to represent data types in the Prisma schema that are not supported by the Prisma Client. `Unsupported` fields can be introspected with `prisma db pull` or created with Prisma Migrate or `db push`. #### Remarks 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 3b713a02f7..c827742111 100644 --- a/content/400-reference/200-api-reference/200-command-reference.mdx +++ b/content/400-reference/200-api-reference/200-command-reference.mdx @@ -378,6 +378,9 @@ The `prisma-client-js` generator creates a customized client for working with yo **MongoDB not supported**
Introspection does not currently support the [MongoDB connector](../../../concepts/database-connectors/mongodb). +**Deprecation warning**
+From Prisma 3.0.0 onwards, the `prisma introspect` command will be deprecated and replaced with the [`prisma db pull`](#db-pull) command. + The `introspect` command connects to your database and adds Prisma models to your Prisma schema that reflect the current database schema. @@ -451,7 +454,7 @@ Run prisma generate to generate Prisma Client. ```terminal -prisma introspect --schema=./alternative/schema.prisma +prisma db pull --schema=./alternative/schema.prisma ``` diff --git a/src/components/customMdx/admonition.tsx b/src/components/customMdx/admonition.tsx index b7ec73cb18..d99ce088e1 100644 --- a/src/components/customMdx/admonition.tsx +++ b/src/components/customMdx/admonition.tsx @@ -16,6 +16,7 @@ const colorMap: any = { } const Admonition = ({ children, type, ...props }: AdmonitionProps) => { + return ( {type === 'alert' && ( @@ -23,13 +24,30 @@ const Admonition = ({ children, type, ...props }: AdmonitionProps) => { )} - {children} + {Array.isArray(children) ? ( + + {children.map((child: any, index: number) => ( + + {child.props.children} + + ))} + + ) : children} ) } export default Admonition +const FlexContainer = styled.div` + display: flex; + flex-direction: column; +` + +const ChildContainer = styled.div` + margin: 1rem 0; +` + const AdmonitionWrapper = styled.span<{ type?: string }>` font-family: Inter; font-style: normal;