Back to Prisma1

Prisma Seed Xcv8

docs/1.34/prisma-cli-and-configuration/cli-command-reference/prisma-seed-xcv8.mdx

1.34.121.1 KB
Original Source

import Code from 'components/Markdown/Code'

export const meta = { title: "prisma1 seed", position: 200, }

$ prisma1 seed

Seeds the service with data.

This command expects that the seed property in prisma.yml is specified.

Usage

sh
prisma1 seed [flags]

Flags

-e, --env-file ENV-FILE    Path to .env file to inject env vars
-r, --reset                Reset the service before seeding

Examples

If you specified the seed property in your prisma.yml, you can run the prisma1 seed command. For example:

<Code languages={["JavaScript", "TypeScript", "Go"]}>

yml
seed:
  run: node ./data/seed.js
yml
seed:
  run: ts-node ./data/seed.ts
yml
seed:
  run: go run ./data/seed.go
</Code>

All sample projects in the prisma-examples repository are based on this seeding mechanism.

Seed service with initial data

sh
prisma1 seed

Seed service with initial data after deleting all of the service's data first

sh
prisma1 seed --reset