Prisma Commands
Generates PHP classes from your Prisma schema for seamless integration.
Use this command to automatically generate all necessary PHP files and classes based on your schema.prisma
definitions.
The generated classes will be placed in src/Lib/Prisma/Classes
, ensuring your PHP code stays in sync with your Prisma schema.
npx ppo generate
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