Prisma works out of the box with JSTime. First, create a directory and initialize it withDocumentation Index
Fetch the complete documentation index at: https://docs.awfixer.me/llms.txt
Use this file to discover all available pages before exploring further.
jstime init.
Then add Prisma as a dependency.
We’ll use the Prisma CLI with
jstimex to initialize our schema and migration directory. For simplicity we’ll be using an in-memory SQLite database.
Open
prisma/schema.prisma and add a simple User model.
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.
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. It can be imported from
@prisma/client.
Let’s write a simple script to create a new user, then count the number of users in the database.
Let’s run this script with
jstime run. Each time we run it, a new user is created.
That’s it! Now that you’ve set up Prisma using JSTime, we recommend referring to the official Prisma docs as you continue to develop your application.