Skip to content

Commit

Permalink
rename photon directory to prisma-client-js
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolasburk committed Jan 15, 2020
1 parent cfdc0fe commit aa0700e
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 36 deletions.
8 changes: 4 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
- [Limitations](./limitations.md)
- [Core](./core)
- Photon
- [API](./photon/api.md)
- [Use only Photon](./photon/use-only-photon.md)
- [Code generation & Node.js setup](./photon/codegen-and-node-setup.md)
- [Deployment](./photon/deployment.md)
- [API](./prisma-client-js/api.md)
- [Use only Photon](./prisma-client-js/use-only-photon.md)
- [Code generation & Node.js setup](./prisma-client-js/codegen-and-node-setup.md)
- [Deployment](./prisma-client-js/deployment.md)
- [Lift](./lift)
- [Importing and exporting data](./import-and-export-data)
- [Supported databases](./supported-databases.md)
Expand Down
6 changes: 3 additions & 3 deletions docs/core/generators/photonjs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prisma Client JS generator

The Prisma Client JS generator can be used in a [Prisma schema file](../../prisma-schema-file.md) to generate Prisma's database client for Node.js and TypeScript. The API of Prisma Client JS is documented [here](../../photon/api.md).
The Prisma Client JS generator can be used in a [Prisma schema file](../../prisma-schema-file.md) to generate Prisma's database client for Node.js and TypeScript. The API of Prisma Client JS is documented [here](../../prisma-client-js/api.md).

## Node.js requirements

Expand All @@ -10,7 +10,7 @@ The generated data access code of the `prisma-client-js` generator targets [ES20

Prisma Client JS depends on a _query engine_ that's running as a _binary_ on the same host as your application. When deploying your Prisma-based application to production, you need to ensure that the binary used by Prisma Client JS can run in your production environment, i.e. it needs to be compatible with the runtime of your deployment provider.

The query engine binary is downloaded when you run `prisma2 generate`, it is then stored alongside the generated Prisma Client JS code inside `node_modules/@prisma` (or the [custom `output` path](../../photon/codegen-and-node-setup.md) you specified). This section explains how you can determine which binary should be downloaded when `prisma2 generate` is executed to ensure compatibility at runtime.
The query engine binary is downloaded when you run `prisma2 generate`, it is then stored alongside the generated Prisma Client JS code inside `node_modules/@prisma` (or the [custom `output` path](../../prisma-client-js/codegen-and-node-setup.md) you specified). This section explains how you can determine which binary should be downloaded when `prisma2 generate` is executed to ensure compatibility at runtime.

You can read more about this topic in the [specification](https://github.com/prisma/specs/blob/master/binaries/Readme.md).

Expand Down Expand Up @@ -89,7 +89,7 @@ Once added, you can invoke the generator using the following command:
prisma2 generate
```

It will then store the generated Prisma Client JS API in the default location `node_modules/@prisma/client` directory. Learn more about the [generated Prisma Client JS API](../../photon/api.md).
It will then store the generated Prisma Client JS API in the default location `node_modules/@prisma/client` directory. Learn more about the [generated Prisma Client JS API](../../prisma-client-js/api.md).

## Mapping types from the data model

Expand Down
4 changes: 2 additions & 2 deletions docs/data-modeling.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Technically, a model can be named anything that adheres to this regular expressi

### Model operations in the Prisma Client JS API (CRUD)

Every _model_ in the data model definition will result in a number of CRUD operations in the generated [Prisma Client JS API](./photon/api.md):
Every _model_ in the data model definition will result in a number of CRUD operations in the generated [Prisma Client JS API](./prisma-client-js/api.md):

- `findMany`
- `findOne`
Expand All @@ -120,7 +120,7 @@ Every _model_ in the data model definition will result in a number of CRUD opera

The operations are accessible via a generated property on the Prisma Client JS instance. By default the name of the property is the plural, lowercase form of the model name, e.g. `users` for a `User` model or `posts` for a `Post` model.

Here is an example illustrating the use of a `users` property from the [Prisma Client JS API](./photon/api.md):
Here is an example illustrating the use of a `users` property from the [Prisma Client JS API](./prisma-client-js/api.md):

```js
const newUser = await prisma.users.create({
Expand Down
2 changes: 1 addition & 1 deletion docs/development-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Whenever you save any changes in the schema file, the development server:
- updates your database schema ([read below](#migrations-in-development-mode))
- creates a [Prisma Studio](https://github.com/prisma/studio) endpoint for you

Depending on whether you're using [only Prisma Client JS](./photon/use-only-photon.md) or [only Lift](./lift/use-only-lift.md), it might only perform one of the above tasks.
Depending on whether you're using [only Prisma Client JS](./prisma-client-js/use-only-photon.md) or [only Lift](./lift/use-only-lift.md), it might only perform one of the above tasks.

## Starting development mode

Expand Down
6 changes: 3 additions & 3 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ However, it's also possible to build your own connectors, more documentation on

### How can I see the generated queries that Prisma Client JS sends to my database?

There will be rich query analytics for Prisma Client JS soon. For now you can set the `debug` option to `true` when instantiating your `PrismaClient` instance. Learn more in the [docs](./photon/api.md#debugging).
There will be rich query analytics for Prisma Client JS soon. For now you can set the `debug` option to `true` when instantiating your `PrismaClient` instance. Learn more in the [docs](./prisma-client-js/api.md#debugging).

### How do schema migrations work with Prisma Client JS?

Prisma Client JS is not opinionated on how exactly you migrate your database schema. You can keep your existing migration system and re-introspect your database schema after each migration to update Prisma Client JS. Learn more in the [docs](./photon/use-only-photon.md). You can also always use [Lift](https://lift.prisma.io) to perform your migrations based on Prisma's declarative [data model definition](./data-modeling.md).
Prisma Client JS is not opinionated on how exactly you migrate your database schema. You can keep your existing migration system and re-introspect your database schema after each migration to update Prisma Client JS. Learn more in the [docs](./prisma-client-js/use-only-photon.md). You can also always use [Lift](https://lift.prisma.io) to perform your migrations based on Prisma's declarative [data model definition](./data-modeling.md).

### Is Prisma Client JS production-ready? Should I start using it?

Expand All @@ -60,7 +60,7 @@ With the Prisma Framework, Prisma's query engine doesn't expose a [spec](https:/

### How to handle connection pooling for Prisma Client JS in serverless environments?

The query engine that's powering the Prisma Client JS API is maintaining a database connection pool. In serverless environments (or when running your application in containers, e.g. using Kubernetes), this connection pool might loose its effectiveness due to the infrastructure it's being deployed on. You can read more about this topic in the [docs](./photon/deployment.md).
The query engine that's powering the Prisma Client JS API is maintaining a database connection pool. In serverless environments (or when running your application in containers, e.g. using Kubernetes), this connection pool might loose its effectiveness due to the infrastructure it's being deployed on. You can read more about this topic in the [docs](./prisma-client-js/deployment.md).

As of now, the recommended workaround is to use a tool like [PgBouncer](https://pgbouncer.github.io/faq.html). We are further exploring some options, such as [enabling a "DB proxy server"](https://github.com/prisma/prisma2/issues/370) (e.g. using a specific generator that generates a Docker image to host Prisma Client JS' query engine) that manages the connection pool for you (similar to the the Prisma 1 architecture).

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ After having selected **MySQL** or **PostgreSQL** in the database selection, you
If you start with an existing database and the Prisma Framework CLI performed introspection against it to generate the [Prisma schema](./prisma-schema-file.md), you will be asked to select which Prisma tools you want to use:

- Use Prisma Client JS and Lift
- [Use only Prisma Client JS](./photon/use-only-photon.md) (for database access (ORM))
- [Use only Prisma Client JS](./prisma-client-js/use-only-photon.md) (for database access (ORM))
- [Use only Lift](./lift/use-only-lift.md) (for database migrations)

> **Note**: If you select **only Prisma Client JS** or **only Lift**, it will still be possible to add the other tool to your project later.
Expand Down
10 changes: 5 additions & 5 deletions docs/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ The migration engine generates the database operations needed to apply a migrati

### Model

[Models](./data-modeling.md#models) represent the _entities of your application domain_. They directly map to structures in the underlying data source, e.g. a _table_ for a relational database or a _collection_ for a document database. The [generated Prisma Client JS API](./photon/api.md) will expose CRUD operations for each model in your [data model](#data-model-definition).
[Models](./data-modeling.md#models) represent the _entities of your application domain_. They directly map to structures in the underlying data source, e.g. a _table_ for a relational database or a _collection_ for a document database. The [generated Prisma Client JS API](./prisma-client-js/api.md) will expose CRUD operations for each model in your [data model](#data-model-definition).

### Data model definition

Expand All @@ -96,13 +96,13 @@ Contains the definitions of all your models. The [data model definition](./data-

### Nested write

Prisma Client JS lets you perform nested creates, nested updates and nested connects for related models. A [nested write](./relations.md#nested-writes) is always performed as an atomic transaction. Learn more about the generated Prisma Client JS API [here](./photon/api.md).
Prisma Client JS lets you perform nested creates, nested updates and nested connects for related models. A [nested write](./relations.md#nested-writes) is always performed as an atomic transaction. Learn more about the generated Prisma Client JS API [here](./prisma-client-js/api.md).

### Prisma Client

> **Note**: Prisma Client has formerly been called Photon. It has been renamed to Prisma Client to simplify the naming and packaging of Prisma 2.
An auto-generated and type-safe database client. Prisma Client is generated using a [generator](#generator) that's specified in your [schema file](#prisma-schema-file). The [generated Prisma Client JS API](./photon/api.md) exposes powerful CRUD operations for you to programmatically access your database.
An auto-generated and type-safe database client. Prisma Client is generated using a [generator](#generator) that's specified in your [schema file](#prisma-schema-file). The [generated Prisma Client JS API](./prisma-client-js/api.md) exposes powerful CRUD operations for you to programmatically access your database.

Prisma currently supports the following languages for Prisma Client:

Expand Down Expand Up @@ -138,13 +138,13 @@ Also sometimes referred to as:

- Payload

Determines what fields of a model are returned in a Prisma Client JS API call. By default, the [selection set](./photon/api.md#selection-sets) contains the fields of the following types:
Determines what fields of a model are returned in a Prisma Client JS API call. By default, the [selection set](./prisma-client-js/api.md#selection-sets) contains the fields of the following types:

- non-lazy [scalar fields](./data-modeling.md#scalar-types)
- enums
- [embed](./data-modeling.md#embeds) fields

The selection set can be manipulated by passing the [`select`](./photon/api.md#select-exclusively-via-select) or [`include`](./photon/api.md#include-additionally-via-include) option to a Prisma Client JS API call.
The selection set can be manipulated by passing the [`select`](./prisma-client-js/api.md#select-exclusively-via-select) or [`include`](./prisma-client-js/api.md#include-additionally-via-include) option to a Prisma Client JS API call.

### Type modifier

Expand Down
2 changes: 1 addition & 1 deletion docs/introspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ When working with an existing database, the first step towards using the Prisma
Prisma lets you introspect your database to derive a data model definition from the current database schema. Introspection is available via either of two CLI commands:

- `prisma2 init`: Interactive wizard that helps you connect to a database and introspect it. Typically used when starting to use Prisma with an existing database.
- `prisma2 introspect`: Assumes Prisma is already connected to your database and (re)introspects it for you. Typically used in ["Prisma Client"-only](./photon/use-only-photon.md) projects where migrations are performed not via Lift, so the data model needs to be updated manually after each database schema change.
- `prisma2 introspect`: Assumes Prisma is already connected to your database and (re)introspects it for you. Typically used in ["Prisma Client"-only](./prisma-client-js/use-only-photon.md) projects where migrations are performed not via Lift, so the data model needs to be updated manually after each database schema change.

Note that `prisma2 introspect` requires the connection string for the database you want to introspect. Therefore, you either need to run the command inside of a directory that contains a [Prisma schema](./prisma-schema-file.md) with a valid `datasource` definition (which contains the connection string) or pass the `--url` argument, e.g.:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ node_modules
└── index.js
```

This is the default path but can be [customized](https://github.com/prisma/prisma2/blob/master/docs/photon/codegen-and-node-setup.md). It is best not to change the files in the generated directory because it will get overwritten every time `prisma2 generate` is invoked.
This is the default path but can be [customized](https://github.com/prisma/prisma2/blob/master/docs/prisma-client-js/codegen-and-node-setup.md). It is best not to change the files in the generated directory because it will get overwritten every time `prisma2 generate` is invoked.

Now you can import Prisma Client JS in your project. Create a main application file, `index.ts`, inside the `src` directory and import the `PrismaClient` constructor:

Expand Down Expand Up @@ -298,7 +298,7 @@ const prisma = new PrismaClient()
```
Now you can start using the `prisma` instance and interact with your database programmatically with the generated Prisma Client JS API.

The `PrismaClient` instance connects [lazily](https://github.com/prisma/prisma2/blob/master/docs/photon/api.md#managing-connections) when the first request is made to the API (`connect()` is called for you under the hood).
The `PrismaClient` instance connects [lazily](https://github.com/prisma/prisma2/blob/master/docs/prisma-client-js/api.md#managing-connections) when the first request is made to the API (`connect()` is called for you under the hood).


## 6. Creating models
Expand Down Expand Up @@ -463,7 +463,7 @@ app.get('/users', async (req, res) => {

```

Your generated Prisma Client JS API will expose the following [CRUD operations](https://github.com/prisma/prisma2/blob/master/docs/photon/api.md#crud) for the `Task` and `User` models:
Your generated Prisma Client JS API will expose the following [CRUD operations](https://github.com/prisma/prisma2/blob/master/docs/prisma-client-js/api.md#crud) for the `Task` and `User` models:
- `findOne`
- `findMany`
- `create`
Expand All @@ -473,7 +473,7 @@ Your generated Prisma Client JS API will expose the following [CRUD operations](
- `delete`
- `deleteMany`

So to implement the same route and endpoint in your Prisma Client JS project, go to your `index.ts` file, and in the `/users` endpoint for the `app.get` route, fetch all the posts from the database with [`findMany`](https://github.com/prisma/prisma2/blob/master/docs/photon/api.md#findMany), a method exposed for the `User` model with the generated Prisma Client JS API. Then send the results back. Note that the API calls are asynchronous so we can `await` the results of the operation.
So to implement the same route and endpoint in your Prisma Client JS project, go to your `index.ts` file, and in the `/users` endpoint for the `app.get` route, fetch all the posts from the database with [`findMany`](https://github.com/prisma/prisma2/blob/master/docs/prisma-client-js/api.md#findMany), a method exposed for the `User` model with the generated Prisma Client JS API. Then send the results back. Note that the API calls are asynchronous so we can `await` the results of the operation.

```ts
import * as express from 'express'
Expand Down Expand Up @@ -621,7 +621,7 @@ The sample project that was used demonstrated the fundamental capabilities of bo

## Next steps

- Learn more about [Prisma Client JS' relation API](https://github.com/prisma/prisma2/blob/master/docs/photon/api.md#relations)
- Learn more about [Prisma Client JS' relation API](https://github.com/prisma/prisma2/blob/master/docs/prisma-client-js/api.md#relations)
- Engage with our [community](https://www.prisma.io/community/)!
- The Prisma Framework is not production-ready [yet](https://github.com/prisma/prisma2/blob/master/docs/limitations.md), so we value your [feedback](https://github.com/prisma/prisma2/blob/master/docs/prisma2-feedback.md)!

Expand Down

0 comments on commit aa0700e

Please sign in to comment.