Repository navigation
docs: move the Prisma tutorial to Prisma ORM 8 and Prisma Postgres - #3505
Open
ankur-arch wants to merge 2 commits into
Open
ankur-arch wants to merge 2 commits into
ankur-arch wants to merge 2 commits into
Conversation
The tutorial ran prisma@latest, which is now a Prisma ORM 8 pre-release with a different CLI, and created PrismaClient with datasourceUrl, which Prisma ORM 7 no longer accepts. Pin the CLI to 7, connect through @prisma/adapter-pg, create the database with create-db instead of pointing readers at a third-party signup, and drop the outdated Accelerate step.
Replaces the Prisma 7 pin with the Prisma ORM 8 setup: orm init with Deno, a contract file, deno task scripts for contract emit and db init, and the ORM 8 query API in the seed script and the Oak routes. Drops the Prisma Studio screenshots the page no longer uses.
Author
|
@thisisjofrank could you take a look when you have a moment? CI is green and every step on the page was run end to end on Deno 2.9.8. Happy to adjust anything. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rewrites
examples/tutorials/prisma.md, which no longer works as written, for Prisma ORM 8:npx prisma@latest initnow runs the Prisma ORM 8 CLI, which has noinit --generator-provider,db pushorgeneratecommands, andnew PrismaClient({ datasourceUrl })was removed in Prisma 7. The page now follows the ORM 8 flow:orm initrun through Deno, a contract file,deno task contract:emitanddeno task db:init, and the ORM 8 query API (db.orm.public.Dinosaur.all(),.where({ id }).first(),.create(),.delete()) in the seed script and the Oak routes.deno.json(nodeModulesDir: "auto") and apackage.json.orm initdetects Deno fromdeno.jsonand installs withdeno add; the CLI scripts live inpackage.jsonand run throughdeno task, which putsnode_modules/.binon the path. The page says why:deno run npm:prismawithout a version resolves to the Prisma 7 CLI, which cannot read the ORM 8 config.--minimum-dependency-age=0is on theorm initcommand, with the reason: Deno 2.9 skips npm versions published in the last 24 hours, and Prisma ORM 8 release candidates ship often.create-db, which gives a free Prisma Postgres database without an account and writesDATABASE_URLto.env, and still says any PostgreSQL connection string works.localhost:8000/dinosaurstypo (the route is/dinosaur) and the Deno Deploy link at the end, which redirected.The
process.envusage from #2615 is kept (src/prisma/db.tsreads it throughdotenv).Tested end to end on Deno 2.9.8 with prisma 8.0.0-rc.30 and @prisma/orm-postgres 8.0.0-rc.22 against a Prisma Postgres database, running the page's commands and code blocks in order on a fresh directory:
orm init,create-db,contract:emit,db:init, the seed script (3 rows), thenmain.tswithGET /dinosaur,POST /dinosaur,GET /dinosaur/4andDELETE /dinosaur/4.deno fmt --check,deno task check:freshnessanddeno test -A frontmatter_test.tspass.Disclosure: I work at Prisma.