lib/src/orm/migrations/MigratorFactory.ts

24 lines
763 B
TypeScript

import {Instantiable, FactoryProducer} from '../../di'
import {Migrator} from './Migrator'
import {DatabaseMigrator} from './DatabaseMigrator'
import {ConfiguredSingletonFactory} from '../../di/factory/ConfiguredSingletonFactory'
/**
* A dependency injection factory that matches the abstract Migrator class
* and produces an instance of the configured session driver implementation.
*/
@FactoryProducer()
export class MigratorFactory extends ConfiguredSingletonFactory<Migrator> {
protected getConfigKey(): string {
return 'database.migrations.driver'
}
protected getDefaultImplementation(): Instantiable<Migrator> {
return DatabaseMigrator
}
protected getAbstractImplementation(): any {
return Migrator
}
}