Reputation: 315
Do you know how can i seed random associative entities with using nestJS + typeORM + nestjs-seeder I only know how to use static element
@Factory('static_var')
or faker
@Factory(faker => faker.name.findName())
or custom functions
@Factory(() => {
const minAge = 18;
const maxAge = 30;
return Math.round(Math.random() * (maxAge - minAge) + minAge);
})
But i want to be able to insert random Ids from an associative table
Upvotes: 2
Views: 1319
Reputation: 1
As I see from the official documentation, you can create entities first, and only then save it. Therefore, before saving, you can change it and add any fields you need. And if before that you saved another entity, you can easily bind them.
Upvotes: 0