romeerez/orchid-orm

[ask] how to build relation data with factory

Closed this issue · 1 comments

I have a activityMember table, the userId field is unique with foreign key

await factory.activityMember.createList(10, {
  userId: 'how to build new user'
})

I published update for this, now it is possible with:

await factory.activityMember.createList(10, {
  userId: async () => (await factory.user.create()).id,
})

In this example, a new user is created for every activity member.