diff options
Diffstat (limited to 'docs/guides/ecosystem')
-rw-r--r-- | docs/guides/ecosystem/prisma.md | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/docs/guides/ecosystem/prisma.md b/docs/guides/ecosystem/prisma.md index af83a47e4..08d56440d 100644 --- a/docs/guides/ecosystem/prisma.md +++ b/docs/guides/ecosystem/prisma.md @@ -11,17 +11,17 @@ name: Get started using Prisma Prisma works out of the box with Bun. First, create a directory and initialize it with `bun init`. ```bash -$ mkdir prisma-app -$ cd prisma-app -$ bun init +mkdir prisma-app +cd prisma-app +bun init ``` --- -Then install the Prisma CLI (`prisma`) and Prisma Client (`@prisma/client`) as dependencies. +Then add Prisma as a dependency. ```bash -$ bun add prisma @prisma/client +bun add prisma ``` --- @@ -29,7 +29,7 @@ $ bun add prisma @prisma/client We'll use the Prisma CLI with `bunx` to initialize our schema and migration directory. For simplicity we'll be using an in-memory SQLite database. ```bash -$ bunx prisma init --datasource-provider sqlite +bunx prisma init --datasource-provider sqlite ``` --- @@ -60,37 +60,14 @@ Then generate and run initial migration. This will generate a `.sql` migration file in `prisma/migrations`, create a new SQLite instance, and execute the migration against the new instance. ```bash -$ bunx prisma migrate dev --name init -Environment variables loaded from .env -Prisma schema loaded from prisma/schema.prisma -Datasource "db": SQLite database "dev.db" at "file:./dev.db" - -SQLite database dev.db created at file:./dev.db - -Applying migration `20230928182242_init` - -The following migration(s) have been created and applied from new schema changes: - -migrations/ - └─ 20230928182242_init/ - └─ migration.sql - -Your database is now in sync with your schema. - -✔ Generated Prisma Client (v5.3.1) to ./node_modules/@prisma/client in 41ms +bunx prisma migrate dev --name init ``` --- -As indicated in the output, Prisma re-generates our _Prisma client_ whenever we execute a new migration. The client provides a fully typed API for reading and writing from our database. You can manually re-generate the client with the Prisma CLI. - -```sh -$ bunx prisma generate -``` - ---- +Prisma automatically generates our _Prisma client_ whenever we execute a new migration. The client provides a fully typed API for reading and writing from our database. -We can import the generated client from `@prisma/client`. +It can be imported from `@prisma/client`. ```ts#src/index.ts import {PrismaClient} from "@prisma/client"; |