prisma db
Manage your database schema and lifecycle.Subcommands
| Command | Description |
|---|---|
prisma db push | Push schema state to database without migrations |
prisma db pull | Pull database state to Prisma schema using introspection |
prisma db seed | Seed your database with test data |
prisma db push
Push the state from your Prisma schema to your database without using migrations.Usage
prisma.config.ts).
Options
Display help message.Alias:
-hCustom path to your Prisma config file.
Custom path to your Prisma schema.
Override the datasource URL from the Prisma config file.
Ignore data loss warnings and proceed with the push.
Force a reset of the database before push. All data will be lost.
Examples
Basic push
Schema already in sync
With data loss warning
Accept data loss automatically
Force reset before push
When to Use db push
- Prototyping: Rapidly iterate on schema during early development
- Local development: Quick schema updates without migration files
- Serverless: Environments where migration files aren’t practical
- Small projects: When migration history isn’t needed
db push vs migrate dev
| Feature | db push | migrate dev |
|---|---|---|
| Migration files | ❌ No | ✅ Yes |
| History tracking | ❌ No | ✅ Yes |
| Team collaboration | ❌ Limited | ✅ Full |
| Production use | ❌ Not recommended | ✅ Recommended |
| Speed | ✅ Fast | Slower |
| Prototyping | ✅ Ideal | Overkill |
prisma db pull
Pull the state from the database to the Prisma schema using introspection.Usage
prisma.config.ts).
Options
Display help message.Alias:
-hCustom path to your Prisma config file.
Custom path to your Prisma schema.
Override the datasource URL from the Prisma config file.
Ignore current Prisma schema file and overwrite it completely.
Print the introspected Prisma schema to stdout instead of writing to file.
Specify the depth for introspecting composite types (e.g., Embedded Documents in MongoDB).Default is
-1 (infinite depth), 0 disables composite types.Specify database schemas to introspect (comma-separated). Overrides schemas in datasource block.
Examples
Basic pull
Print to stdout
Force overwrite
Specify schemas
public and auth schemas.
Set composite type depth
When to Use db pull
- Existing database: Import schema from an existing database
- Database-first workflow: Database is source of truth
- Schema synchronization: Update Prisma schema after manual DB changes
- Migration from other ORMs: Convert existing schema to Prisma
Introspection Warnings
You may see warnings about unsupported features:prisma db seed
Seed your database with test or initial data.Usage
Options
Display help message.Alias:
-hCustom path to your Prisma config file.
Passing Arguments to Seed Script
You can pass extra arguments to your seed script using--:
Examples
Basic seed
Pass arguments to seed script
Configuration
Configure seeding in yourprisma.config.ts:
Example Seed Script
No Seed Command Configured
If no seed command is configured:Related Commands
prisma migrate dev- Create and apply migrationsprisma migrate deploy- Deploy migrations to productionprisma generate- Generate Prisma Client