Prisma Commands
Creates and applies database migrations in a development environment. Also updates Prisma schema.
npx prisma migrate dev
Resets the database by dropping all data and applying all migrations from scratch.
npx prisma migrate reset
Applies pending migrations to the database, typically used in a production environment.
npx prisma migrate deploy
Pushes the Prisma schema state to the database without generating migration files.
npx prisma db push
Updates the Prisma schema by introspecting the database.
npx prisma db pull
Generates Prisma Client based on the current Prisma schema.
npx prisma generate
Formats the Prisma schema file for better readability and consistency.
npx prisma studio
Opens Prisma Studio, a GUI to view and edit the data in your database.
npx prisma format
Seeding Data with Prisma
To populate your database with initial data, execute the seed script defined in the prisma/seed.js
file. This script is responsible for inserting predefined data sets into your database, which can be essential for development, testing, or initial production setups. Run the following command to trigger the seeding process:
npx prisma db seed