import type { Constructor, IMigrationGenerator, IMigrationRunner, IMigrator, IMigratorStorage, MaybePromise, Migration, MigrationInfo, MigrationRow, MigratorEvent } from '../typings.js'; import type { Transaction } from '../connections/Connection.js'; import type { Configuration, MigrationsOptions } from './Configuration.js'; import type { EntityManagerType, IDatabaseDriver } from '../drivers/IDatabaseDriver.js'; interface RunnableMigration { name: string; path?: string; up: () => MaybePromise; down: () => MaybePromise; } type MigrateOptions = { from?: string | number; to?: string | number; migrations?: string[]; transaction?: Transaction; }; export declare abstract class AbstractMigrator implements IMigrator { #private; protected readonly em: D[typeof EntityManagerType]; protected runner: IMigrationRunner; protected storage: IMigratorStorage; protected generator: IMigrationGenerator; protected readonly driver: D; protected readonly config: Configuration; protected readonly options: MigrationsOptions; protected absolutePath: string; protected initialized: boolean; constructor(em: D[typeof EntityManagerType]); protected abstract createRunner(): IMigrationRunner; protected abstract createStorage(): IMigratorStorage; protected abstract getDefaultGenerator(): IMigrationGenerator; abstract create(path?: string, blank?: boolean, initial?: boolean, name?: string): Promise<{ fileName: string; code: string; diff: { up: string[]; down: string[]; }; }>; abstract checkSchema(): Promise; abstract createInitial(path?: string, name?: string, blank?: boolean): Promise<{ fileName: string; code: string; diff: { up: string[]; down: string[]; }; }>; /** * @inheritDoc */ on(eventName: MigratorEvent, listener: (event: MigrationInfo) => MaybePromise): this; /** * @inheritDoc */ off(eventName: MigratorEvent, listener: (event: MigrationInfo) => MaybePromise): this; /** * @inheritDoc */ getExecuted(): Promise; /** * @inheritDoc */ getPending(): Promise; /** * @inheritDoc */ up(options?: string | string[] | MigrateOptions): Promise; /** * @inheritDoc */ down(options?: string | string[] | Omit): Promise; abstract getStorage(): IMigratorStorage; protected init(): Promise; protected initServices(): void; protected resolve(params: { name: string; path: string; }): RunnableMigration; protected initialize(MigrationClass: Constructor, name: string): RunnableMigration; /** * Checks if `src` folder exists, it so, tries to adjust the migrations and seeders paths automatically to use it. * If there is a `dist` or `build` folder, it will be used for the JS variant (`path` option), while the `src` folder will be * used for the TS variant (`pathTs` option). * * If the default folder exists (e.g. `/migrations`), the config will respect that, so this auto-detection should not * break existing projects, only help with the new ones. */ private detectSourceFolder; private registerDefaultListeners; private emit; private discoverMigrations; private executeMigrations; private filterUp; private filterDown; private getMigrationFilename; private prefix; protected runMigrations(method: 'up' | 'down', options?: string | string[] | MigrateOptions): Promise; private runInTransaction; } export {};