Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions content/800-data-platform/200-projects/100-create.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br /><br />
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.

<Admonition>

**Note**<br /><br />

The pre-filled path `prisma/schema.prisma` is the default path. Change it to the path you use for your project.

</Admonition>

5. Click **Link Prisma schema**.<br />
<img
src="../images/projects/create-02-link-schema-file-from-a-repository.png"
alt="Prisma Data Platform - Create project - Link a schema from a repository - Select GitHub account, repository, branch, and Prisma schema path"
width="600px"
/>

#### 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

<Admonition>

**Note**<br /><br />

The schema preview does not contain any syntax highlighting for your schema file.

</Admonition>

3. Click **Upload file**.<br />

<img
src="../images/projects/create-02-upload-schema-file.png"
alt="Prisma Data Platform - Create project - Upload your schema - Select Prisma schema file from file system"
width="600px"
/>

#### 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.

Comment thread
ruheni marked this conversation as resolved.
#### 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.
Expand Down
126 changes: 82 additions & 44 deletions content/800-data-platform/250-environments/200-create.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -38,32 +38,32 @@ If you already have schema synchronization enabled for the default Production en
### Steps

1. From the **Environments** drop-down menu, select **Create new environment**.
<img
src="../images/environments/create-01-drop-down-select-create.png"
alt="Prisma Data Platform - Create environment - Open Environments drop-down menu and select Create new environment"
width="450px"
/>
<img
src="../images/environments/create-01-drop-down-select-create.png"
alt="Prisma Data Platform - Create environment - Open Environments drop-down menu and select Create new environment"
width="450px"
/>
2. In **Environment name**, enter a name for the environment.

<Admonition>

**Note**<br /><br />
Use any naming convention that makes sense for your project.<br /><br />
If applicable, you can use the Staging, Development, or &lt;Feature name&gt; conventions to dedicate an environment to a database development workflow or the development of a specific feature.
**Note**<br /><br />
Use any naming convention that makes sense for your project.<br /><br />
If applicable, you can use the Staging, Development, or &lt;Feature name&gt; conventions to dedicate an environment to a database development workflow or the development of a specific feature.

</Admonition>

3. Enable schema synchronization for the new environment.

<Admonition>

**Note**<br /><br />
**Note**<br /><br />

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.

</Admonition>

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.

<Admonition type="alert">

Expand All @@ -75,7 +75,7 @@ If you already have schema synchronization enabled for the default Production en

</Admonition>

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.

<Admonition>

Expand All @@ -90,28 +90,28 @@ If you already have schema synchronization enabled for the default Production en

<Admonition>

**Note**<br /><br />
**Note**<br /><br />

For more information, see [Static egress IP address](/data-platform/static-ips).
For more information, see [Static egress IP address](/data-platform/static-ips).

</Admonition>

7. Under **Data Proxy**, from the **Location** drop-down menu, select the geographic location for the Data Proxy.

<Admonition>

**Note**<br /><br />
**Note**<br /><br />

Select a Data Proxy location that is close to the geographic location of the database for the new environment.<br /><br />
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.<br /><br />
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.

</Admonition>

<Admonition type="alert">

**Important**<br /><br />
**Important**<br /><br />

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.

</Admonition>

Expand Down Expand Up @@ -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**.

<img
src="../images/environments/create-01-drop-down-select-create.png"
alt="Prisma Data Platform - Create environment - Open Environments drop-down menu and select Create new environment"
width="450px"
/>
{' '}
<img
src="../images/environments/create-01-drop-down-select-create.png"
alt="Prisma Data Platform - Create environment - Open Environments drop-down menu and select Create new environment"
width="450px"
/>

2. In **Environment name**, enter a name for the environment.

<Admonition>

**Note**<br /><br />
Use any naming convention that makes sense for your project.<br /><br />
If applicable, you can use the Staging, Development, or &lt;Feature name&gt; conventions to dedicate an environment to a database development workflow or the development of a specific feature.
**Note**<br /><br />
Use any naming convention that makes sense for your project.<br /><br />
If applicable, you can use the Staging, Development, or &lt;Feature name&gt; conventions to dedicate an environment to a database development workflow or the development of a specific feature.

</Admonition>

Expand All @@ -178,37 +179,37 @@ If you do not yet have schema synchronization enabled for the Production environ

<Admonition>

**Note**<br /><br />
**Note**<br /><br />

For more information, see [Static egress IP address](/data-platform/static-ips).
For more information, see [Static egress IP address](/data-platform/static-ips).

</Admonition>

5. Under **Data Proxy**, from the **Location** drop-down menu, select the geographic location for the Data Proxy.

<Admonition>

**Note**<br /><br />
**Note**<br /><br />

Select a Data Proxy location that is close to the geographic location of the database for the new environment.<br /><br />
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.<br /><br />
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.

</Admonition>

<Admonition type="alert">

**Important**<br /><br />
**Important**<br /><br />

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.

</Admonition>

6. Click **Create environment**.
<img
src="../images/environments/create-no-schema-sync-02-repo-branch-database-connection-string-data-proxy.png"
alt="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"
width="450px"
/>
<img
src="../images/environments/create-no-schema-sync-02-repo-branch-database-connection-string-data-proxy.png"
alt="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"
width="450px"
/>

### Result

Expand All @@ -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**

<img
src="../images/environments/create-env-upload-schema-file.png"
alt="Prisma Data Platform - Create environment - Upload a schema file button"
width="600px"
/>

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

<Admonition>

**Note**<br /><br />

The schema preview does not contain any syntax highlighting for your schema file.

</Admonition>

4. Click **Upload file**.<br />

<img
src="../images/projects/create-02-upload-schema-file.png"
alt="Prisma Data Platform - Create environment - Upload your schema - Select Prisma schema file from file system"
width="600px"
/>

### 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).
Expand All @@ -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).
- 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).
29 changes: 27 additions & 2 deletions content/800-data-platform/700-schema-viewer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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**

<Admonition>

**Note**<br /><br />

The schema preview does not contain any syntax highlighting for your schema file.

</Admonition>

<img
src="images/schema-viewer/project-schema-viewer.png"
title="Schema Viewer - Projects with no models and no Prisma schema"
alt="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.

Expand All @@ -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

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.