Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Prisma · Command

prisma db seed

prisma db seed runs the command configured in migrations.seed to populate a database with initial or test data. In Prisma ORM v7, it must be invoked explicitly.

Since
4.15.0

How it works

The command executes the seed command configured under migrations.seed in prisma.config.ts. In Prisma ORM v7, seeding is explicit, so running this command is what invokes the configured script.

Syntax

prisma db seed [options]

Parameters

NameTypeDescription
optionsCLI optionsOptional Prisma CLI flags, including --help and --config.
seed argumentscommand-line argumentsArguments forwarded to the configured seed command after --.

Returns

Runs the configured seed command and exits with that command's status.

Key points

  • Use this command to populate a database with initial or test data through your configured seed script.
  • The command accepts optional CLI flags in addition to its basic form.
  • The configured migrations.seed value determines exactly which command executes.
  • Typical uses include setting up test data and preparing a fresh development database.
  • Use --config when the Prisma configuration file is not in its default location.
  • Use the argument separator to forward custom values to the seed script.

Common mistakes

  • Do not expect prisma migrate dev or prisma migrate reset to run the seed script automatically in Prisma ORM v7.
  • Arguments intended for the seed script must follow --, rather than being supplied as ordinary Prisma CLI options.

Example: Seed the database

npx prisma db seed

Runs the seed command configured in the migrations.seed field of prisma.config.ts.

When to use it

Development setup

Populate a newly created development database with baseline records.

Test setup

Create predictable records before automated tests run.

Parameterized seeding

Forward environment-specific values to the seed script.

Interview questions

QWhat does prisma db seed execute?

It runs the command stored in the seed property of the migrations object in prisma.config.ts. That configured command can invoke a JavaScript or TypeScript seed script.

Follow-up: How do you pass arguments to the seed script? Put them after the -- delimiter, for example prisma db seed -- --environment test.

QWhen does Prisma run the seed command?

In Prisma ORM v7, this command is the explicit trigger for database seeding. Migration commands no longer invoke seeding automatically.

Follow-up: What changed from Prisma ORM v6? Automatic seeding after prisma migrate dev or prisma migrate reset was removed in v7.

QWhich options are available?

The command supports help, a custom Prisma config path through --config, and arguments forwarded to the seed command after --. The basic form is prisma db seed [options].

Follow-up: How can you use a non-default configuration file? Supply its path with the --config option.

  • prisma.config.ts
  • migrations.seed
  • prisma migrate dev
  • prisma migrate reset
  • --skip-seed

Source: Prisma CLI | prisma db seed. Checked 2026-10-16.