DEV Community
•
2026-04-22 11:17
Generating Realistic Seed Data That Respects Foreign Keys, in 20 Seconds
Someone asks for a demo. You need 10,000 users, 30,000 orders, a handful of
products, and enough variety that the UI does not look fake. You have
twenty minutes.
If you have been here before, you know the options:
Write a seed script. Open your editor, import Faker, write the
loops, get the foreign keys wrong twice, rerun, get them right, run
into a FOREIGN KEY constraint violation on line 847...