Without a seed script, every prisma migrate reset during development requires manual recreation of test accounts, sample data, and edge-case records. New developers spend hours setting up a usable dev environment instead of writing code. More critically, automated tests that depend on database state cannot run reproducibly in CI without seed data, leading to test infrastructure that is too fragile to run in automated pipelines. ISO 25010 testability requires that the system can be placed into a known state for testing; a seed script is the minimal mechanism for achieving this.
Low because missing seed data degrades developer productivity and test reliability without causing runtime failures in production.
Create prisma/seed.ts (or equivalent for your ORM) with synthetic data using @faker-js/faker and register it in package.json. Use bcrypt-hashed placeholder passwords, never real credentials.
// prisma/seed.ts
import { PrismaClient } from '@prisma/client'
import { faker } from '@faker-js/faker'
const prisma = new PrismaClient()
async function main() {
for (let i = 0; i < 10; i++) {
const user = await prisma.user.create({
data: { email: faker.internet.email(), name: faker.person.fullName() }
})
await prisma.post.createMany({
data: Array.from({ length: 3 }).map(() => ({
title: faker.lorem.sentence(), userId: user.id
}))
})
}
}
main().finally(() => prisma.$disconnect())
// package.json
{ "prisma": { "seed": "npx ts-node prisma/seed.ts" } }
Run with npx prisma db seed. For CI, include this after prisma migrate deploy in the test setup step.
ID: database-design-operations.migration-versioning.seed-data-available
Severity: low
What to look for: Count every seed-related file in the project. Prisma: prisma/seed.ts or prisma/seed.js, and "prisma": { "seed": "ts-node prisma/seed.ts" } in package.json. Knex: seeds/ directory with Knex seed files. Supabase: supabase/seed.sql file. Custom: scripts/seed.ts, scripts/seed.js, or db/seed.* files. Check package.json scripts for seed, db:seed, prisma:seed. Also check whether seed data is realistic (good for development) and whether it uses synthetic data (important — real user data should never be used as seed data). Check if there are test fixtures or factory functions for automated testing.
Pass criteria: Seed scripts exist and can populate the database with representative test data. Seed data is synthetic (generated with faker or hand-crafted — not real production data). Running the seed script creates enough data to exercise the application's main features. Scripts are referenced in package.json or documentation.
Fail criteria: No seed script anywhere. Developers must manually create test accounts and data after every prisma migrate reset. No factory functions or fixtures for automated tests.
Skip (N/A) when: Application has no persistent data that benefits from seeding (truly stateless service with no user accounts or content). Or application uses only authentication with no application-specific data to seed.
Detail on fail: Specify what is missing. Example: "No seed script found. After prisma migrate reset, developers must manually create test data — slowing onboarding and test setup.".
Remediation: Create a seed script:
// prisma/seed.ts
import { PrismaClient } from '@prisma/client'
import { faker } from '@faker-js/faker'
const prisma = new PrismaClient()
async function main() {
console.log('Seeding database...')
// Create test users
const users = await Promise.all(
Array.from({ length: 10 }).map(() =>
prisma.user.create({
data: {
email: faker.internet.email(),
name: faker.person.fullName(),
passwordHash: '$2b$10$placeholder_bcrypt_hash', // bcrypt hash of 'password123'
}
})
)
)
// Create test content
for (const user of users) {
await prisma.post.createMany({
data: Array.from({ length: 3 }).map(() => ({
title: faker.lorem.sentence(),
content: faker.lorem.paragraphs(3),
userId: user.id,
}))
})
}
console.log(`Seeded: ${users.length} users, ${users.length * 3} posts`)
}
main()
.catch(console.error)
.finally(() => prisma.$disconnect())
// package.json — register seed script
{
"prisma": {
"seed": "npx ts-node prisma/seed.ts"
},
"scripts": {
"db:seed": "npx prisma db seed"
}
}
Install faker: npm install -D @faker-js/faker