Skip to content

Commit

Permalink
Merge branch 'main' into pulse-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolasburk committed May 13, 2024
2 parents c651f38 + 6ead326 commit 0f6e6eb
Show file tree
Hide file tree
Showing 129 changed files with 5,381 additions and 4,618 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/doc_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: ✍ Documentation request or bug
about: Report a content issue (incorrect content, spelling mistake, broken link), request new content, or suggest an improvement.
labels: 'docs'
assignees: ''
labels: "docs"
assignees: ""
---
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/website_request.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: ✨ Doc site request or bug
about: Request a website feature or improvement, or report a bug. For documentation, please use documentation request.
labels: 'website'
labels: "website"
---
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/z_doc_release.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: 🎉 Documentation release
about: INTERNAL ONLY. Documentation release tasks.
title: 'Release:'
labels: 'docs,docs/task'
assignees: ''
title: "Release:"
labels: "docs,docs/task"
assignees: ""
---

## Release
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/create-or-update-comment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ inputs:
body-includes:
description: An optional string to search by (use this almost always)
required: false
default: 'bot'
default: "bot"
runs:
using: composite
steps:
Expand All @@ -19,7 +19,7 @@ runs:
id: find-existing
with:
issue-number: ${{ inputs.pull-request }}
comment-author: 'github-actions[bot]'
comment-author: "github-actions[bot]"
body-includes: ${{ inputs.body-includes }}

- name: Create comment
Expand Down
11 changes: 11 additions & 0 deletions .github/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0

# Prettify all selected files
echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --write

# Add back the modified/prettified files to staging
echo "$FILES" | xargs git add

exit 0
18 changes: 9 additions & 9 deletions .github/workflows/image-optimise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ name: Compress images
on:
pull_request:
paths:
- '**.jpg'
- '**.jpeg'
- '**.png'
- '**.webp'
- "**.jpg"
- "**.jpeg"
- "**.png"
- "**.webp"
push:
branches:
- main
paths:
- '**.jpg'
- '**.jpeg'
- '**.png'
- '**.webp'
- "**.jpg"
- "**.jpeg"
- "**.png"
- "**.webp"
workflow_dispatch:
schedule:
- cron: '00 23 * * 0'
- cron: "00 23 * * 0"
jobs:
build:
name: calibreapp/image-actions
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/list-changed-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
branches:
- main
paths:
- 'content/**/*'
- "content/**/*"

jobs:
post-files-changed-comment:
name: 'Post files changed comment'
name: "Post files changed comment"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -49,4 +49,4 @@ jobs:
with:
pull-request: ${{ github.event.pull_request.number }}
body: ${{ steps.build-comment-body.outputs.body }}
body-includes: 'original | preview'
body-includes: "original | preview"
2 changes: 1 addition & 1 deletion .github/workflows/lost-pixel.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Lost Pixel'
name: "Lost Pixel"
on: [push]

jobs:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ on:
branches:
- main
paths:
- 'content/**/*'
- "content/**/*"
pull_request:
branches:
- main
paths:
- 'content/**/*'
- "content/**/*"
jobs:
spellcheck:
name: 'Docs: Spellcheck'
name: "Docs: Spellcheck"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Check out the code
- uses: actions/setup-node@v4
name: Setup node
with:
node-version: '18'
node-version: "18"
- run: npm install -g cspell
name: Install cSpell
- run: cspell --config ./cSpell.json "content/**/*.mdx" --no-progress
Expand Down
7 changes: 4 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
public/
.cache/
static/
out/
history/
*.mdx
*.mdx
plugins/
.husky/
.docusaurus/
10 changes: 6 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"printWidth": 100,
"jsxBracketSameLine": false,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"singleQuote": false,
"trailingComma": "es5",
"semi": true
"semi": true,
"singleAttributePerLine": false,
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css"
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,23 @@ $ mdtool remove 2
# Result: 01-a, 02-b, 03-c, 04-d becomes 01-a, 02-b, 02-c, 03-d; 02-b is supposed to be manually deleted
```

### Prettier

To align with the current standards specified in our `.prettierc` configuration, it's recommended to include the `pre-commit` hook within the `/.github/` directory. This can be achieved by executing the following commands from the project's root:

```bash
mv /.github/pre-commit /.git/hooks/
```

After that, and upon executing a commit command, you may encounter the following message:

```
hint: The '.git/hooks/pre-commit' hook was ignored because it's not set as executable.
hint: You can disable this warning with `git config advice.ignoredHook false`.
```

To address this, you can follow the provided instructions to disable the `ignoredHook` flag.

#### Thanks Luca

![](https://res.cloudinary.com/prismaio/image/upload/v1628765536/docs/LJ0FGHk_u2jjxv.png)
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
22 changes: 18 additions & 4 deletions content/100-getting-started/01-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ One of the main features of Prisma Client is the ease of working with [relations

First, adjust your script to include the nested query:

```ts file=script.ts highlight=6-17;add showLineNumbers
```ts file=script.ts highlight=6-24;add showLineNumbers
import { PrismaClient } from '@prisma/client'

const prisma = new PrismaClient()
Expand All @@ -274,9 +274,16 @@ async function main() {
name: 'Bob',
email: 'bob@prisma.io',
posts: {
create: {
title: 'Hello World',
},
create: [
{
title: 'Hello World',
published: true
},
{
title: 'My second post',
content: 'This is still a draft'
}
],
},
},
})
Expand Down Expand Up @@ -374,6 +381,13 @@ npx ts-node script.ts
id: 1,
title: 'Hello World',
content: null,
published: true,
authorId: 2
},
{
id: 2,
title: 'My second post',
content: 'This is still a draft',
published: false,
authorId: 2
}
Expand Down
8 changes: 4 additions & 4 deletions content/200-orm/050-overview/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Overview",
"collapsible": false,
"collapsed": false
}
"label": "Overview",
"collapsible": false,
"collapsed": false
}
3 changes: 1 addition & 2 deletions content/200-orm/100-prisma-schema/50-introspection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ Here's an overview of its main functions on SQL databases:

On MongoDB, the main functions are the following:

- Map _collections_ in the database to [Prisma models](/orm/prisma-schema/data-model/models#defining-models)
- Map _documents_ in the collections to the [fields](/orm/prisma-schema/data-model/models#defining-fields) of Prisma models by _sampling them_
- Map _collections_ in the database to [Prisma models](/orm/prisma-schema/data-model/models#defining-models). Because a _collection_ in MongoDB doesn't have a predefined structure, Prisma ORM _samples_ the _documents_ in the collection and derives the model structure accordingly (i.e. it maps the fields of the _document_ to the [fields](/orm/prisma-schema/data-model/models#defining-fields) of the Prisma model). If _embedded types_ are detected in a collection, these will be mapped to [composite types](/orm/prisma-schema/data-model/models#defining-composite-types) in the Prisma schema.
- Map _indexes_ in the database to [indexes](/orm/prisma-schema/data-model/models#defining-an-index) in the Prisma schema, if the collection contains at least one document contains a field included in the index

You can learn more about how Prisma ORM maps types from the database to the types available in the Prisma schema on the respective docs page for the data source connector:
Expand Down
8 changes: 4 additions & 4 deletions content/200-orm/100-prisma-schema/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Prisma Schema",
"collapsible": false,
"collapsed": false
}
"label": "Prisma Schema",
"collapsible": false,
"collapsed": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ The n+1 problem occurs when you loop through the results of a query and perform

</div>

The Prisma Client dataloader automatically **batches** `findUnique()` queries that ✔ occur in the same tick and ✔ have the same `where` and `include` parameters.
The Prisma Client dataloader automatically _batches_ `findUnique()` queries that occur in the same [tick](https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick#processnexttick) and have the same `where` and `include` parameters if:

- All criteria of the `where` filter are on scalar fields (unique or non-unique) of the same model you're querying.
- All criteria use the `equal` filter, whether that's via the shorthand or explicit syntax `(where: { field: <val>, field1: { equals: <val> } })`.
- No boolean operators or relation filters are present.

Automatic batching of `findUnique()` is particularly useful in a **GraphQL context**. GraphQL runs a separate resolver function for every field, which can make it difficult to optimize a nested query.

Expand Down
8 changes: 4 additions & 4 deletions content/200-orm/200-prisma-client/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Prisma Client",
"collapsible": false,
"collapsed": false
}
"label": "Prisma Client",
"collapsible": false,
"collapsed": false
}
8 changes: 4 additions & 4 deletions content/200-orm/300-prisma-migrate/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Prisma Migrate",
"collapsible": false,
"collapsed": false
}
"label": "Prisma Migrate",
"collapsible": false,
"collapsed": false
}
2 changes: 1 addition & 1 deletion content/200-orm/400-tools/05-prisma-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npm install prisma --save-dev

### Yarn

Install with [yarn](https://yarnpkg.dev/):
Install with [yarn](https://yarnpkg.com/):

```
yarn add prisma --dev
Expand Down
8 changes: 4 additions & 4 deletions content/200-orm/400-tools/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Tools",
"collapsible": false,
"collapsed": false
}
"label": "Tools",
"collapsible": false,
"collapsed": false
}
8 changes: 4 additions & 4 deletions content/200-orm/500-reference/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Reference",
"collapsible": false,
"collapsed": false
}
"label": "Reference",
"collapsible": false,
"collapsed": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,11 @@ Prisma ORM has begun adding support for [third-party database drivers](https://w

Additionally, Prisma ORM supports CockroachDB, Microsoft SQL Server, and MongoDB, which Drizzle does not currently support. Prisma ORM also offers the [relation mode](/orm/prisma-schema/data-model/relations/relation-mode) that allows Prisma ORM to emulate foreign key constraints for those database engines that do not support it. Drizzle currently supports Cloudflare D1, `bun:sqlite`, and SQLite via HTTP Proxy, which Prisma ORM currently does not.

## Benchmarks
We understand that performance is a key consideration when selecting an ORM. To compare performance of various ORMs, you can use the open-source [database latency benchmark tool](https://pris.ly/benchmark) hosted by Vercel.

This tool allows you to evaluate the latency and throughput of various ORMs under different workloads and configurations. By running the benchmarks against the databases or database providers you are considering, you can get a clear picture of their relative performance characteristics to help make an informed decision.

## Conclusion

Both Drizzle ORM and Prisma ORM are tools for data access and migrations. Drizzle is focused on being a thin wrapper around a SQL-like syntax while Prisma is focused on a convenient and expressive API. Other important differences include Prisma ORM's support of MSSQL and MongoDB, support for additional features via [Prisma Client extensions](/orm/prisma-client/client-extensions), additional cloud-ready products, and a robust ecosystem.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const prismaClientSingleton = () => {
}

declare const globalThis: {
prisma: ReturnType<typeof prismaClientSingleton>;
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;

const prisma = globalThis.prismaGlobal ?? prismaClientSingleton()
Expand Down
8 changes: 4 additions & 4 deletions content/200-orm/800-more/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "More",
"collapsible": false,
"collapsed": false
}
"label": "More",
"collapsible": false,
"collapsed": false
}

0 comments on commit 0f6e6eb

Please sign in to comment.