diff --git a/content/800-data-platform/200-projects/100-create.mdx b/content/800-data-platform/200-projects/100-create.mdx index 68f0278503..bc178d7385 100644 --- a/content/800-data-platform/200-projects/100-create.mdx +++ b/content/800-data-platform/200-projects/100-create.mdx @@ -96,14 +96,94 @@ As a result, [Data Browser](/data-platform/data-browser) and [Query Console](/da The platform introspects the database to read the data models so that it can generate the Prisma schema. The Prisma schema enables the features in [Data Browser](/data-platform/data-browser) and [Query Console](/data-platform/query-console), where you can edit and query your data. +#### If introspection fails and can't generate a schema + +You will be prompted a notification telling that your project was created but introspection failed. Introspection may fail if the database is unreachable or the process timeouts. In order to utilize the Data Browser or Query Console, a project must have a valid Prisma schema that matches with the provided database. + +Upon introspection failure, you will be taken to a "Provide schema" view, where you can [provide a schema](#optional-provide-a-schema) by either linking a schema from a repository or upload your schema. + + ### What's next - Click **Skip and continue to Data Platform** to go to **Data Browser** for your project.

If your database is empty, you are redirected to **Schema Viewer** where you can optionally provide a GitHub repository with your Prisma schema to set up schema synchronization. +- If introspection fails, you can remain on the **Provide a schema** screen and complete project setup + - [(Optional) Provide a schema](#optional-provide-a-schema) - Alternatively, remain on the **Get started** screen and complete the optional configurations for your project. - [(Optional) Enable Prisma schema synchronization](#optional-enable-schema-synchronization) - [(Optional) Create a Data Proxy connection string](#optional-create-a-data-proxy-connection-string) +## (Optional) Provide a schema + +After you create a project but introspection fails, you can provide a schema on the **Provide a schema** screen. You can provide a schema by either linking a schema from a repository or uploading your schema file + +You can link a schema from a repository to keep your project's Prisma schema and data models in **Data Browser** and **Query Console** updated with the latest version of your Prisma schema. + +#### Link a schema from a repository + +Steps: + +1. On the **Link a schema from a repository** section, from **GitHub Account**, select a GitHub account or organization. +2. From **Repository**, select the GitHub repository you want to import. +3. From **Branch**, select the branch you want to import. +4. In **Prisma schema path**, enter the path to the `schema.prisma` file. + + + + **Note**

+ + The pre-filled path `prisma/schema.prisma` is the default path. Change it to the path you use for your project. + +
+ +5. Click **Link Prisma schema**.
+ Prisma Data Platform - Create project - Link a schema from a repository - Select GitHub account, repository, branch, and Prisma schema path + +#### Result + +A Prisma schema is now linked to your project. + +The platform updates the Prisma schema in your project every time you push a schema change to your repository. + +#### Upload a schema file + +Steps: + +1. On the **Or upload your schema** section, either: + - Click on the _drop zone_ to open your file manager and select your schema + - Drag and drop your schema file to the _drop zone_ +2. Review the preview of your schema file + + + + **Note**

+ + The schema preview does not contain any syntax highlighting for your schema file. + +
+ +3. Click **Upload file**.
+ + Prisma Data Platform - Create project - Upload your schema - Select Prisma schema file from file system + +#### Result + +A Prisma schema is now linked to your project. However, the schema will not be synchronized with your project. You can manually synchronize the Prisma schema in your project by refreshing the schema in the **Schema** tab of your project. + +To keep your schema in sync with your project, you can link the project to a GitHub repository. + +#### What's next + +You can now use [Data Browser](/data-platform/data-browser) and [Query Console](/data-platform/query-console) with the latest version of your Prisma schema. + ## (Optional) Enable schema synchronization After you create the project, you can enable automated schema synchronization on the **Get started** screen. This means that if you push your Prisma schema to a GitHub repository, you can link the Prisma schema and the GitHub repository to your project. diff --git a/content/800-data-platform/250-environments/200-create.mdx b/content/800-data-platform/250-environments/200-create.mdx index 249c254ae0..2cb957382c 100644 --- a/content/800-data-platform/250-environments/200-create.mdx +++ b/content/800-data-platform/250-environments/200-create.mdx @@ -19,10 +19,10 @@ When you create a new environment on a project, the steps differ slightly depend The table below shows the different project configurations and provides links to the correct steps to create a new environment for each project configuration. -| Configuration | Steps | -| --------------------------------------------------------------- | ---------------------------------------------------------------- | -| Projects with enabled schema synchronization | [Steps](#projects-with-enabled-schema-synchronization) | -| Projects with introspected schema or no schema (empty database) | [Steps](#projects-with-an-introspected-schema-or-with-no-schema) | +| Configuration | Steps | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------- | +| Projects with enabled schema synchronization | [Steps](#projects-with-enabled-schema-synchronization) | +| Projects with introspected schema or no schema (empty database) or uploaded schema | [Steps](#projects-with-an-introspected-schema-or-with-no-schema) | ## Projects with enabled schema synchronization @@ -38,18 +38,18 @@ If you already have schema synchronization enabled for the default Production en ### Steps 1. From the **Environments** drop-down menu, select **Create new environment**. - Prisma Data Platform - Create environment - Open Environments drop-down menu and select Create new environment + Prisma Data Platform - Create environment - Open Environments drop-down menu and select Create new environment 2. In **Environment name**, enter a name for the environment. - **Note**

- Use any naming convention that makes sense for your project.

- If applicable, you can use the Staging, Development, or <Feature name> conventions to dedicate an environment to a database development workflow or the development of a specific feature. +**Note**

+Use any naming convention that makes sense for your project.

+If applicable, you can use the Staging, Development, or <Feature name> conventions to dedicate an environment to a database development workflow or the development of a specific feature.
@@ -57,13 +57,13 @@ If you already have schema synchronization enabled for the default Production en - **Note**

+**Note**

- The steps to enable schema synchronization on new environments are available only if you have already enabled schema synchronization on the default Production environment for the same project. +The steps to enable schema synchronization on new environments are available only if you have already enabled schema synchronization on the default Production environment for the same project.
- a. From **Branch**, select the branch of the project repository that you want to use for the new environment. +a. From **Branch**, select the branch of the project repository that you want to use for the new environment. @@ -75,7 +75,7 @@ If you already have schema synchronization enabled for the default Production en - b. In **Prisma Schema path**, enter the path to the `schema.prisma` file. +b. In **Prisma Schema path**, enter the path to the `schema.prisma` file. @@ -90,9 +90,9 @@ If you already have schema synchronization enabled for the default Production en - **Note**

+**Note**

- For more information, see [Static egress IP address](/data-platform/static-ips). +For more information, see [Static egress IP address](/data-platform/static-ips).
@@ -100,18 +100,18 @@ If you already have schema synchronization enabled for the default Production en - **Note**

+**Note**

- Select a Data Proxy location that is close to the geographic location of the database for the new environment.

- If you select a location that is geographically distant from the database, then when your application sends requests to the database through the Data Proxy, you might notice some delay in the responses. +Select a Data Proxy location that is close to the geographic location of the database for the new environment.

+If you select a location that is geographically distant from the database, then when your application sends requests to the database through the Data Proxy, you might notice some delay in the responses.
- **Important**

+**Important**

- After you create an environment, you cannot change its Data Proxy location. You can select a different Data Proxy location only when you create a new environment. +After you create an environment, you cannot change its Data Proxy location. You can select a different Data Proxy location only when you create a new environment.
@@ -157,19 +157,20 @@ If you do not yet have schema synchronization enabled for the Production environ 1. From the **Environments** drop-down menu, select **Create new environment**. - Prisma Data Platform - Create environment - Open Environments drop-down menu and select Create new environment +{' '} +Prisma Data Platform - Create environment - Open Environments drop-down menu and select Create new environment 2. In **Environment name**, enter a name for the environment. - **Note**

- Use any naming convention that makes sense for your project.

- If applicable, you can use the Staging, Development, or <Feature name> conventions to dedicate an environment to a database development workflow or the development of a specific feature. +**Note**

+Use any naming convention that makes sense for your project.

+If applicable, you can use the Staging, Development, or <Feature name> conventions to dedicate an environment to a database development workflow or the development of a specific feature.
@@ -178,9 +179,9 @@ If you do not yet have schema synchronization enabled for the Production environ - **Note**

+**Note**

- For more information, see [Static egress IP address](/data-platform/static-ips). +For more information, see [Static egress IP address](/data-platform/static-ips).
@@ -188,27 +189,27 @@ If you do not yet have schema synchronization enabled for the Production environ - **Note**

+**Note**

- Select a Data Proxy location that is close to the geographic location of the database for the new environment.

- If you select a location that is geographically distant from the database, then when your application sends requests to the database through the Data Proxy, you might notice some delay in the responses. +Select a Data Proxy location that is close to the geographic location of the database for the new environment.

+If you select a location that is geographically distant from the database, then when your application sends requests to the database through the Data Proxy, you might notice some delay in the responses.
- **Important**

+**Important**

- After you create an environment, you cannot change its Data Proxy location. You can select a different Data Proxy location only when you create a new environment. +After you create an environment, you cannot change its Data Proxy location. You can select a different Data Proxy location only when you create a new environment.
6. Click **Create environment**. - Prisma Data Platform - Create environment - Name environment, select branch, enter Prisma schema path, enter a database connection string, select Data Proxy region, enable firewalled connection via static IPs to your database + Prisma Data Platform - Create environment - Name environment, select branch, enter Prisma schema path, enter a database connection string, select Data Proxy region, enable firewalled connection via static IPs to your database ### Result @@ -228,6 +229,43 @@ The platform introspects the database to read the data models so that it can gen Your browser is redirected to **Data Browser** for the new environment. +#### If introspection fails and can't generate a schema + +You will be prompted with an error notification that introspection failed. This means the environment was not created. The error prompt will contain an **Upload a schema** button that will allow you to complete environment creation by [uploading a schema](#upload-a-schema-file). + +##### Upload a schema file + +Steps: + +1. On the notification, click **Upload a schema file** + + Prisma Data Platform - Create environment - Upload a schema file button + +2. On the **Upload a schema file** section, either + - Click on the _drop zone_ to open your file manager and select your schema + - Drag and drop your schema file to the _drop zone_ +3. Review the preview of your schema file + + + + **Note**

+ + The schema preview does not contain any syntax highlighting for your schema file. + +
+ +4. Click **Upload file**.
+ + Prisma Data Platform - Create environment - Upload your schema - Select Prisma schema file from file system + ### What's next You can switch between the environments of a project from the **Environments** drop-down menu in the upper left (next to the **Projects** drop-down). @@ -239,4 +277,4 @@ You can switch between the environments of a project from the **Environments** d /> - After you switch to a different environment, **Data Browser** and **Query Console** use the database and Data Proxy location configured for that environment. -- What **Schema Viewer** shows differs depending on whether your database is empty or contains some models. For more information, see [Manage schema updates with Schema Viewer](/data-platform/schema-viewer). \ No newline at end of file +- What **Schema Viewer** shows differs depending on whether your database is empty or contains some models. For more information, see [Manage schema updates with Schema Viewer](/data-platform/schema-viewer). diff --git a/content/800-data-platform/700-schema-viewer.mdx b/content/800-data-platform/700-schema-viewer.mdx index bd3486084d..48e13d3065 100644 --- a/content/800-data-platform/700-schema-viewer.mdx +++ b/content/800-data-platform/700-schema-viewer.mdx @@ -63,9 +63,34 @@ You can use the **Refresh Schema** option only if you are the [Project owner](/d alt="Schema Viewer - Projects with introspected Prisma schema" /> +### Upload a schema file + +If the schema refresh fails, an error notification pops up at the top of the page with the option to upload a schema file. + +Click the **upload a schema** link in the notification. Below the **Provide a schema** section, a new **Upload a Prisma schema file** section is enabled. You can either: + +- Click on the _drop zone_ to open your file manager and select your schema +- Drag and drop your schema file to the _drop zone_ + +Review the contents of the schema file in the _drop zone_ and once you are done, click **Upload file** + + + +**Note**

+ +The schema preview does not contain any syntax highlighting for your schema file. + +
+ +Schema Viewer - Projects with no models and no Prisma schema + ## Projects without a schema -If you create your project with an empty database (one which contains no models) and do not enable schema synchronization, the platform tries to introspect the database but because that contains no models, the platform cannot generate a Prisma schema for it. +If introspection fails during project creation and you chose to skip providing a schema, your project exist without an associated schema. For such projects, **Schema Viewer** does not show a schema and provides the option to link a Prisma schema from a GitHub repository or to manually trigger a new introspection. @@ -75,7 +100,7 @@ For such projects, **Schema Viewer** does not show a schema and provides the opt alt="Schema Viewer - Projects with no models and no Prisma schema" /> -For such projects, [**Data Browser**](/data-platform/data-browser) and [**Query Console**](/data-platform/query-console) remain inactive until you enable schema synchronization or manually trigger a new introspection. +The [**Data Browser**](/data-platform/data-browser) and [**Query Console**](/data-platform/query-console) remain disabled until you enable schema synchronization or manually re-trigger a new introspection. ## Enable schema synchronization diff --git a/content/800-data-platform/images/environments/create-env-upload-schema-file.png b/content/800-data-platform/images/environments/create-env-upload-schema-file.png new file mode 100644 index 0000000000..27e814109a Binary files /dev/null and b/content/800-data-platform/images/environments/create-env-upload-schema-file.png differ diff --git a/content/800-data-platform/images/projects/create-02-link-schema-file-from-a-repository.png b/content/800-data-platform/images/projects/create-02-link-schema-file-from-a-repository.png new file mode 100644 index 0000000000..dc4bc00f8f Binary files /dev/null and b/content/800-data-platform/images/projects/create-02-link-schema-file-from-a-repository.png differ diff --git a/content/800-data-platform/images/projects/create-02-upload-schema-file.png b/content/800-data-platform/images/projects/create-02-upload-schema-file.png new file mode 100644 index 0000000000..842466f163 Binary files /dev/null and b/content/800-data-platform/images/projects/create-02-upload-schema-file.png differ diff --git a/content/800-data-platform/images/schema-viewer/project-schema-viewer.png b/content/800-data-platform/images/schema-viewer/project-schema-viewer.png new file mode 100644 index 0000000000..bdec4d7cf3 Binary files /dev/null and b/content/800-data-platform/images/schema-viewer/project-schema-viewer.png differ