Skip to content

Prisma のバージョンを最新にアップデート#946

Open
chelproc wants to merge 22 commits into
mainfrom
update-prisma-to-latest-version
Open

Prisma のバージョンを最新にアップデート#946
chelproc wants to merge 22 commits into
mainfrom
update-prisma-to-latest-version

Conversation

@chelproc

@chelproc chelproc commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Prisma のバージョンを v7 にアップデート
自動生成ファイルが TypeScript ベースになったが、Node.js v22.18 のアップデートにより、問題なく使えるようになった。

https://nodejs.org/en/learn/typescript/run-natively

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 21, 2026

Copy link
Copy Markdown

Deploying utcode-learn with  Cloudflare Pages  Cloudflare Pages

Latest commit: c64720c
Status: ✅  Deploy successful!
Preview URL: https://f0e6bf91.utcode-learn.pages.dev
Branch Preview URL: https://update-prisma-to-latest-vers.utcode-learn.pages.dev

View logs

@chelproc chelproc force-pushed the update-prisma-to-latest-version branch 3 times, most recently from ab790cb to a108f20 Compare March 21, 2026 10:44
@chelproc chelproc marked this pull request as ready for review March 21, 2026 11:12
@chelproc chelproc force-pushed the update-prisma-to-latest-version branch from 9e052db to 2e79eda Compare April 12, 2026 06:36

@chvmvd chvmvd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

途中までレビューしたのですが、そもそも動作していないような気がします...

Comment thread docs/3-web-servers/08-database/index.mdx Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以前の動画では自動生成されたパスワードをメモ帳アプリに保存していましたが、現在の動画ではクリップボードに保存しているだけになっているので、学習者がパスワードを紛失してしまう事例が出てしまいそうな気がします。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

また考えます!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらはパスワードを紛失する事例がかなり出てしまうような気がするので、できるだけ直したい気がします

Comment thread docs/3-web-servers/08-database/index.mdx Outdated
Comment thread docs/3-web-servers/08-database/index.mdx Outdated
Comment thread docs/3-web-servers/08-database/index.mdx Outdated
Comment thread docs/3-web-servers/08-database/index.mdx Outdated
Comment thread docs/3-web-servers/08-database/index.mdx Outdated
Comment thread docs/3-web-servers/08-database/index.mdx Outdated
Comment thread docs/3-web-servers/08-database/index.mdx
Comment thread docs/3-web-servers/08-database/prisma-init.mp4
@chvmvd

chvmvd commented May 2, 2026

Copy link
Copy Markdown
Contributor

「Cookieと認証(発展)」の節でもPrismaを使用しているので、こちらも合わせて修正したいですね 👀

Comment thread docs/3-web-servers/08-database/index.mdx
@chelproc chelproc force-pushed the update-prisma-to-latest-version branch from 4e670e1 to 791fb0c Compare May 9, 2026 09:35
@chelproc chelproc force-pushed the update-prisma-to-latest-version branch from 791fb0c to ae1cdad Compare May 9, 2026 09:36
@chelproc

Copy link
Copy Markdown
Contributor Author

#961 を cherry-pick

@chelproc chelproc requested review from Yokomi422 and chvmvd June 13, 2026 05:33

### 手順2

新しいプロジェクト用のディレクトリを作成し、`npx prisma init`コマンドを実行して、Prismaのセットアップをしましょう。`.env`ファイルを編集し、Prismaがデータベースに接続できるようにしましょう。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここらへんの手順がアップデートされていなさそうです。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらはパスワードを紛失する事例がかなり出てしまうような気がするので、できるだけ直したい気がします


```javascript
import { PrismaClient } from "./generated/prisma/index.js";
import "dotenv/config";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「フロントエンドとバックエンドの連携とデプロイ」の節では、main.jsimport "dotenv/config";と書くのではなく、プログラムを実行する際にnode --env-file=.env main.jsのようなコマンドを実行しているためいずれかに揃えたいですね。
cf.

"dev": "tsx --env-file=.env main.ts"

const client = new PrismaClient();
const todos = await client.todo.findMany();
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
const prisma = new PrismaClient({ adapter: adapter });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「フロントエンドとバックエンドの連携とデプロイ」の節では、const client = new PrismaClient({ adapter });と記述しているのでいずれかに揃えたいですね。

cf.

const client = new PrismaClient({ adapter });

これら3つのメソッドは、<Term>非同期処理</Term>を行います。

まずは、`findMany`メソッドの戻り値を、デバッガを用いて確認してみましょう。
まずは、`findMany`メソッドの戻り値を、デバッガを用いて確認してみましょう。`PrismaClient`は、`@prisma/adapter-pg`パッケージの`PrismaPg`クラスを介してPostgreSQLに接続します。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここですが、この文脈ではPrismaClientよりもPrisma Clientの方が正確な気がします。

@chvmvd

chvmvd commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

「Cookieと認証(発展)」の節でもPrismaを使用しているので、こちらも合わせて修正したいですね 👀

^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants