Skip to content

@joakimbugge/typeorm-seeder


@joakimbugge/typeorm-seeder / CreateManyOptions

Interface: CreateManyOptions<T>

Defined in: seed/creator.ts:46

Options for createMany. Extends SeedContext with a required instance count.

Extends

Type Parameters

T

T extends EntityInstance = EntityInstance

Properties

count

ts
count: number;

Defined in: seed/creator.ts:47


dataSource?

ts
optional dataSource?: DataSource;

Defined in: seed/registry.ts:20

The TypeORM DataSource. Automatically set by save/saveMany calls. Also available in factory callbacks — useful for looking up existing entities instead of creating new ones:

Example

ts
@Seed(async ({ dataSource }) => dataSource.getRepository(Role).findOneByOrFail({ name: 'admin' }))
role!: Role

Inherited from

SeedContext.dataSource


relations?

ts
optional relations?: boolean;

Defined in: seed/registry.ts:29

Set to false to skip automatic relation seeding. Scalar and embedded properties are still seeded; only relation properties decorated with a bare @Seed() are skipped. Useful when you want to create flat entities and wire relations yourself.

Default

ts
true

Inherited from

SeedContext.relations


values?

ts
optional values?: SeedValues<T>;

Defined in: seed/creator.ts:48

Released under the MIT License.