Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit 471578c

Browse files
authored
Merge branch 'main' into feat/add-snaplet-seed-recipe-example
2 parents d586f8f + b31909a commit 471578c

File tree

42 files changed

+1128
-339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1128
-339
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Post Comment
2+
description: Create or update a comment on a pull request
3+
inputs:
4+
pull-request:
5+
description: The PR (number) to post in
6+
required: true
7+
body:
8+
description: The comment body (will replace if comment already exists)
9+
required: true
10+
body-includes:
11+
description: An optional string to search by (use this almost always)
12+
required: false
13+
default: 'bot'
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Find existing comment
18+
uses: peter-evans/find-comment@v3
19+
id: find-existing
20+
with:
21+
issue-number: ${{ inputs.pull-request }}
22+
comment-author: 'github-actions[bot]'
23+
body-includes: ${{ inputs.body-includes }}
24+
25+
- name: Create comment
26+
if: steps.find-existing.outputs.comment-id == ''
27+
uses: peter-evans/create-or-update-comment@v4
28+
with:
29+
issue-number: ${{ inputs.pull-request }}
30+
body: ${{ inputs.body }}
31+
32+
- name: Update comment
33+
if: steps.find-existing.outputs.comment-id != ''
34+
uses: peter-evans/create-or-update-comment@v4
35+
with:
36+
comment-id: ${{ steps.find-existing.outputs.comment-id }}
37+
body: ${{ inputs.body }}
38+
edit-mode: replace

.github/workflows/check-all-links.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Check all content (MDX) links
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
check-for-absolute-urls:
8+
name: "Check for absolute prisma.io urls"
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: check for docs urls
14+
id: absolute-urls
15+
run: |
16+
FILES_WITH_ABS_URLS=$(grep -Erl "https://prisma\.io/docs|https://www\.prisma\.io/docs" content) || echo "no absolute URLs found."
17+
OUTPUT="## Absolute URL check"$'\n'
18+
SUCCESS=false
19+
if [ -n "${FILES_WITH_ABS_URLS}" ]; then # if there were matching files
20+
OUTPUT+="The following files have absolute URLs to prisma.io/docs. Please replace them with relative URLs."$'\n'
21+
OUTPUT+="Example: https://www.prisma.io/docs/getting-started/quickstart -> /getting-started/quickstart"$'\n'
22+
for line in ${FILES_WITH_ABS_URLS}
23+
do
24+
OUTPUT+="${line}"$'\n'
25+
done
26+
else
27+
# no matching files
28+
OUTPUT+="No absolute URLs to prisma.io/docs found."
29+
SUCCESS=true
30+
fi
31+
# https://github.com/orgs/community/discussions/26288#discussioncomment-3876281
32+
{
33+
echo 'body<<EOF'
34+
echo "$OUTPUT"
35+
echo EOF
36+
} >> "$GITHUB_OUTPUT"
37+
echo "success=${SUCCESS}" >> "$GITHUB_OUTPUT"
38+
39+
- uses: ./.github/actions/create-or-update-comment
40+
with:
41+
pull-request: ${{ github.event.pull_request.number }}
42+
body: ${{ steps.absolute-urls.outputs.body }}
43+
body-includes: absolute URLs
44+
45+
- name: report success
46+
run: |
47+
if ${{ steps.absolute-urls.outputs.success }}; then
48+
exit 0;
49+
else
50+
exit 1;
51+
fi
52+
53+
check-for-dead-external-links:
54+
name: Check external links
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: actions/setup-node@v4
59+
with:
60+
node-version: 18
61+
62+
- name: Install deps
63+
run: npm install
64+
65+
- name: Install remark presets
66+
run: npm install remark-lint-no-dead-urls
67+
68+
- name: run remark-cli
69+
env:
70+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
71+
run: |
72+
npx remark-cli . -qf -e=md,mdx --use=remark-mdx --use remark-frontmatter --use remark-gfm \
73+
--use "remark-lint-no-dead-urls=skipLocalhost:true,skipUrlPatterns:['https://www.notion.so/prismaio','https://www.prisma.io/docs','https://dash.cloudflare.com','https://www.cloudflare.com']"
74+
75+
check-for-dead-internal-links:
76+
name: Check internal links
77+
runs-on: ubuntu-latest
78+
79+
steps:
80+
- uses: actions/checkout@v4
81+
- uses: actions/setup-node@v4
82+
with:
83+
node-version: 18
84+
85+
- name: Install deps
86+
run: npm install
87+
88+
- name: test build
89+
run: npm run clean && npm run build
90+
91+
check-for-redirects:
92+
name: Check for needed redirects
93+
runs-on: ubuntu-latest
94+
95+
steps:
96+
- uses: actions/checkout@v4
97+
98+
- name: Create suggested redirects
99+
id: redirects
100+
run: |
101+
bash .github/workflows/scripts/generate-redirects.sh
102+
103+
- uses: ./.github/actions/create-or-update-comment
104+
with:
105+
pull-request: ${{ github.event.pull_request.number }}
106+
body: ${{ steps.redirects.outputs.body }}
107+
body-includes: following redirects

.github/workflows/list-changed-pages.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
env:
2525
CHANGED_FILES: ${{ steps.changed-files.outputs.any_changed }}
2626
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
27-
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
27+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
2828
run: |
2929
shopt -s extglob # enable extended globbing
3030
OUTPUT=""
@@ -36,33 +36,17 @@ jobs:
3636
FILE_PATH=${FILE_PATH#content\/} # remove "content/"
3737
FILE_PATH=${FILE_PATH%.mdx} # remove ".mdx"
3838
FILE_PATH=${FILE_PATH%index} # remove "index"
39-
OUTPUT+="| [${file}](https://www.prisma.io/docs/${FILE_PATH}) | [${file}](https://${BRANCH_NAME}.docs-51g.pages.dev/${FILE_PATH}) |%0A"
39+
OUTPUT+="| [${file}](https://www.prisma.io/docs/${FILE_PATH}) | [${file}](https://${BRANCH_NAME//\//-}.docs-51g.pages.dev/${FILE_PATH}) |%0A"
4040
done
4141
else
4242
OUTPUT="No files changed."
4343
fi
4444
echo "::set-output name=body::$OUTPUT"
4545
shopt -u extglob # disable extended globbing
4646
47-
- name: Find existing comment
48-
uses: peter-evans/find-comment@v3
49-
id: find-existing
47+
- name: Post comment
48+
uses: ./.github/actions/create-or-update-comment
5049
with:
51-
issue-number: ${{ github.event.pull_request.number }}
52-
comment-author: 'github-actions[bot]'
53-
body-includes: 'original | preview'
54-
55-
- name: Create comment
56-
if: steps.find-existing.outputs.comment-id == ''
57-
uses: peter-evans/create-or-update-comment@v4
58-
with:
59-
issue-number: ${{ github.event.pull_request.number }}
50+
pull-request: ${{ github.event.pull_request.number }}
6051
body: ${{ steps.build-comment-body.outputs.body }}
61-
62-
- name: Update comment
63-
if: steps.find-existing.outputs.comment-id != ''
64-
uses: peter-evans/create-or-update-comment@v4
65-
with:
66-
comment-id: ${{ steps.find-existing.outputs.comment-id }}
67-
body: ${{ steps.build-comment-body.outputs.body }}
68-
edit-mode: replace
52+
body-includes: 'original | preview'

.github/workflows/scripts/generate-redirects.sh

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
body="This PR probably requires the following redirects to be added to vercel.json:%0A%0A"
3+
body="## Redirect check%0AThis PR probably requires the following redirects to be added to static/_redirects:%0A%0A"
44
no_changed_pages="%0A- This PR does not change any pages in a way that would require a redirect."
55

66
echo $GITHUB_BASE_REF
@@ -10,7 +10,7 @@ git reset --soft origin/$GITHUB_BASE_REF
1010
git status -s
1111
status=$(git status -s)
1212

13-
while IFS= read -r line
13+
while IFS= read -r line
1414
do
1515
# Split line into parts
1616
IFS=' '
@@ -23,7 +23,7 @@ do
2323
if [[ "${values[0]}" != "D" && "${values[0]}" != "R" ]]; then
2424
continue
2525
fi
26-
26+
2727
# Delete msg for no edited pages and start code block
2828
if [ -n "$no_changed_pages" ]; then
2929
no_changed_pages=""
@@ -43,26 +43,18 @@ do
4343
# clean paths
4444
path1_cleaned=$(echo "$path1" | sed -E 's:content/:/:g' | sed -e 's/.mdx//g' | sed -E 's:/[0-9]+-:/:g' )
4545
path2_cleaned=$(echo "$path2" | sed -E 's:content/:/:g' | sed -e 's/.mdx//g' | sed -E 's:/[0-9]+-:/:g' )
46-
46+
4747
# special case for deletion
4848
if [[ "${values[0]}" == "D" ]]; then
4949
path2_cleaned="/##( TODO: Path of page that replaces deleted page )##"
5050
fi
5151

52-
redirect=$(cat <<-END
53-
{
54-
"source": "/docs$path1_cleaned",
55-
"destination": "/docs$path2_cleaned"
56-
},
52+
redirect="$path1_cleaned /docs$path2_cleaned"
5753

58-
END
59-
)
6054
echo $redirect
6155
echo ""
6256
body="$body$redirect%0A"
6357

64-
#echo "foo"
65-
6658

6759
done < <(printf '%s\n' "$status")
6860

@@ -71,4 +63,3 @@ body=$(echo "$body" | sed ':a;N;$!ba;s/\n/%0A/g')
7163
echo $body
7264

7365
echo "::set-output name=body::$body"
74-

content/200-orm/050-overview/100-introduction/200-why-prisma.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ This is way more convenient and comes closer to the mental model developers have
6363

6464
> ORM represents a quagmire which starts well, gets more complicated as time passes, and before long entraps its users in a commitment that has no clear demarcation point, no clear win conditions, and no clear exit strategy.
6565
>
66-
> [The Vietnam of Computer Science, Ted Neward (2006)](http://blogs.tedneward.com/post/the-vietnam-of-computer-science/)
66+
> [The Vietnam of Computer Science, Ted Neward (2006)](https://web.archive.org/web/20220823105749/http://blogs.tedneward.com/post/the-vietnam-of-computer-science/)
6767
6868
As an application developer, the mental model you have for your data is that of an _object_. The mental model for data in SQL on the other hand are _tables_.
6969

content/200-orm/050-overview/100-introduction/250-should-you-use-prisma.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ No matter if you're a SQL newcomer or veteran, Prisma ORM will give you a signif
2828

2929
Here are a couple of the guiding principles and general practices we apply when designing and building our tools:
3030

31-
- [make the right thing easy](https://git.io/right-thing-easy-thing)
31+
- [make the right thing easy](https://jason.energy/right-thing-easy-thing/)
3232
- [pit of success](https://blog.codinghorror.com/falling-into-the-pit-of-success/)
3333
- offer intelligent autocompletion where possible
3434
- build powerful editor extensions (e.g. for [VS Code](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma))

content/200-orm/050-overview/500-databases/950-cloudflare-d1.mdx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -145,22 +145,6 @@ npx wrangler d1 migrations apply __YOUR_DATABASE_NAME__ --remote
145145

146146
For any further migrations, you can use the same workflow but instead of using `--from-empty`, you'll need to use `--from-local-d1` because your source schema for the `prisma migrate diff` command now is the current schema of that local D1 instance, while the target remains your (then updated) Prisma schema.
147147

148-
<!-- For any further migrations, you can use the same workflow but instead of using `--from-empty`, you'll need to use `--from-url __FILE_PATH_` (where `__FILE_PATH_` points to your local D1 instance) because your source schema for the `prisma migrate diff` command now is the current schema of that local D1 instance, while the target remains your (then updated) Prisma schema. -->
149-
150-
<!-- #### 1. Locate the SQLite database file in `.wrangler`
151-
152-
Your local D1 instance is represented by a SQLite database file that's stored in `./wrangler/state/d1`. Locate this file and grab the full path to the SQLite database instance. It likely looks similar to this:
153-
154-
```no-copy
155-
./.wrangler/state/v3/d1/miniflare-D1DatabaseObject/0fee8d0e0152078a4a36c1a547dec875c1c7aa598e931fbbefdd7bff19d3d60d.sqlite
156-
```
157-
158-
Keep this file path handy since you'll need it for any future migrations. The instructions will refer to the file path as:
159-
160-
```
161-
./.wrangler/state/v3/d1/miniflare-D1DatabaseObject/__YOUR_DB__.sqlite
162-
``` -->
163-
164148
#### 1. Update your Prisma data model
165149

166150
Assume you have updated your Prisma schema with another model:
@@ -211,15 +195,6 @@ npx prisma migrate diff \
211195
--output migrations/0002_create_post_table.sql
212196
```
213197

214-
<!-- ```terminal
215-
npx prisma migrate diff \
216-
--from-url file:./.wrangler/state/v3/d1/miniflare-D1DatabaseObject/__YOUR_DB__.sqlite \
217-
--to-schema-datamodel ./prisma/schema.prisma \
218-
--script > migrations/0002_create_post_table.sql
219-
```
220-
221-
> **Note**: Remember that you need to replace `__YOUR_DB__` with the long string of numbers and characters that represent the file name of your local D1 instance. -->
222-
223198
The command above uses the following options:
224199

225200
- `--from-local-d1`: The source for the SQL statement is the local D1 database file.

content/200-orm/100-prisma-schema/10-overview/index.mdx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -263,26 +263,6 @@ block _ {
263263
}
264264
```
265265

266-
<!--
267-
Multiline objects follow their own nested formatting rules:
268-
269-
```
270-
block _ {
271-
key = "value"
272-
key2 = 1
273-
key10 = {
274-
a = "a"
275-
b = "b"
276-
}
277-
key10 = [
278-
1,
279-
2
280-
]
281-
}
282-
283-
```
284-
-->
285-
286266
#### Field definitions are aligned into columns separated by 2 or more spaces
287267

288268
```

content/200-orm/100-prisma-schema/20-data-model/20-relations/420-relation-mode.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ However, when you _create_ a record, Prisma ORM does not emulate any foreign key
161161

162162
When you _update_ or _delete_ a record with related records, Prisma ORM will emulate referential actions.
163163

164-
<!-- TODO: list actions with brief description? -->
165-
166164
The following table shows which emulated referential actions are available for each database connector:
167165

168166
| Database | Cascade | Restrict | NoAction | SetNull | SetDefault |

content/200-orm/100-prisma-schema/20-data-model/20-relations/500-troubleshooting-relations.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Take the following example, here a relation table is created to act as the JOIN
151151

152152
The back relation fields are missing from the `Post` to `PostCategories` and `Category` to `PostCategories` models.
153153

154-
<!-- prettier-ignore-start -->
154+
155155
```prisma
156156
// This example schema shows how NOT to define an explicit m-n relation
157157
@@ -175,7 +175,7 @@ model Category {
175175
posts Post[] // This should refer to PostCategories
176176
}
177177
```
178-
<!-- prettier-ignore-end -->
178+
179179

180180
To fix this the `Post` model needs to have a many relation field defined with the relation table `PostCategories`. The same applies to the `Category` model.
181181

0 commit comments

Comments
 (0)