drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
23.88k stars 596 forks source link

[FEATURE]: Factories #995

Closed MatanYadaev closed 4 days ago

MatanYadaev commented 1 year ago

Describe what you want

A factory API that allows creating testing data easily.

Example API inspired by Laravel Eloquent Factories:

// Generates 5 users in a 'verified' state with the password set as 'secret'.
// Each of these users will have 10 associated posts.
const users = await database
    .factory(users)
    .count(5)
    .state('verified')
    .has(database.factory(posts).count(10))
    .set({
        password: 'secret',
    });
L-Mario564 commented 4 days ago

Closing in favor of #733.