We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prisma is a popular Node.js and TypeScript ORM.
npx svelte-add@latest prisma
Here is the setup for Prisma that uses a SQLite database which is a great starting point and easy to swap out later.
# initialize Prisma npx prisma init --datasource-provider-sqlite # install Prisma client npm i @prisma/client
This creates a prisma folder with a schema.prisma and adds an .env file with the connection string pointing to the database.
prisma
schema.prisma
.env
The migrate command is going to create the database from the Prisma schema and run a seed script if it's configured.
migrate
npx prisma migrate dev --name init
To query the database one also needs to export the Prisma client which is a file that can be created inside lib/database.ts.
lib/database.ts
import { PrismaClient } from '@prisma/client' const db = new PrismaClient() export default db
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What Is Prisma?
Prisma is a popular Node.js and TypeScript ORM.
How It Should Work
Prisma Setup
Here is the setup for Prisma that uses a SQLite database which is a great starting point and easy to swap out later.
This creates a
prisma
folder with aschema.prisma
and adds an.env
file with the connection string pointing to the database.The
migrate
command is going to create the database from the Prisma schema and run a seed script if it's configured.To query the database one also needs to export the Prisma client which is a file that can be created inside
lib/database.ts
.The text was updated successfully, but these errors were encountered: