Skip to main content

QSeed

@quik/database


@quik/database / QSeed

Abstract Class: QSeed

Defined in: database/src/migrations/QSeed.ts:34

Base class for all database seeders.

Implementations should extend this class and provide logic for both seeding and resetting data inside a transaction.

Implements

Constructors

Constructor

new QSeed(): QSeed

Returns

QSeed

Accessors

seedName

Get Signature

get seedName(): string

Defined in: database/src/migrations/QSeed.ts:39

Gets the name of the seed class. Used for identifying seeds in logs.

Returns

string

Methods

reset()

abstract reset(engine): Promise<void>

Defined in: database/src/migrations/QSeed.ts:57

Reverts the migration to rollback changes made to the database schema.

Parameters

engine

Transaction

The Knex transaction instance

Returns

Promise<void>

Throws

If the seed cannot be reset

Implementation of

IQSeed.reset


seed()

abstract seed(engine): Promise<void>

Defined in: database/src/migrations/QSeed.ts:49

Applies the database seeder.

Parameters

engine

Transaction

The Knex transaction instance

Returns

Promise<void>

Throws

If the seed cannot be applied

Implementation of

IQSeed.seed