パッケージの使い方の最新へのアップデートとPrisma 6.18.0への対応 #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
すべてのパッケージをアップデートし、Prisma 6.18.0に対応しました。
prisma db pushの際に自動でprismaと@prisma/clientがインストールされていましたが、Prisma 6.18.0以降は事前にこれらをインストールしておく必要があるようになったようです。prisma initをした際に生成されるファイルでprisma.config.tsが使用されるようになりました。cf. https://www.prisma.io/blog/announcing-prisma-6-18-0#init-with-prismaconfigts-automaticallyprisma initをした際に生成されるファイルでは、prisma-client-jsgeneratorではなくprisma-clientgeneratorが使用されるようになったようです。prisma-clientgeneratorを使用することで、.envファイルが自動で読み込まれなくなりました。(cf. https://www.prisma.io/docs/orm/prisma-schema/overview/generators#prisma-client )TypeScriptファイルやJavaScriptファイルを実行する際には、--env-file=.envなどによって.envファイルを読み込む必要があります。(cf. https://www.prisma.io/docs/orm/reference/prisma-config-reference#using-environment-variables )prisma db pushをする際などのために、prisma.config.ts内でdotenvを使用する必要があるのではないかと考えられます。prisma-clientgeneratorでは、prisma generateをした際にTypeScriptファイルが生成されるため、tsconfig.jsonでallowJsオプションをtrueにする必要がなくなりました。 cf. https://www.prisma.io/docs/orm/prisma-schema/overview/generators#prisma-clientprisma-clientgeneratorを使用することで、Prisma Clientのインポート方法が変わりました。 cf. https://www.prisma.io/docs/orm/prisma-schema/overview/generators#importing-prisma-clientprisma.config.tsファイルの拡張子が.tsであり動かすには、拡張子を.mtsにする必要が出てきたため、package.jsonのtypeフィールドをmoduleにしました。