import { DataSource } from 'typeorm'; export type QuerySetKey = 'upQueries' | 'downQueries'; export type QuerySets = Record; export type QuerySet = Query[]; export type Query = { query: string; parameters: any[] | null | undefined; }; export type QueryExecution = { name: string; querySet: QuerySet; }; export type MigrationsOptions = { migrationsTableName?: string; migrationsDir?: string; /** @default `true` when `process.env.NODE_ENV === 'development'` otherwise `false` */ generateMigrations?: boolean; }; export type RunMigrationsOptions = { /** * Only run migrations less than or equal to this date; and, if any migrations are generated, generate them with this date. * @default now */ timestamp?: Date; }; export type RunLockOptions = { lock: { acquire: () => Promise<{ release: () => Promise; }>; }; }; export declare function runMigrations(dataSource: DataSource, options: MigrationsOptions & RunMigrationsOptions & RunLockOptions): Promise<{ pendingQueryExecuted: QueryExecution[]; newQueryExcuted: QueryExecution[]; }>; /** * `0000000000000` is a special migration, useful if you are switching from TypeORM's `synchronize` method to migrations. * `0000000000000` will be skipped if any table in the entity schema already exists. * If you are switching from `synchronize` to migrations you should use a new database and generate a migration against that, then rename the migration to `0000000000000-generated.yml`. */ export declare class Migrations { private dataSource; static defaultOptions: Required; options: Required; constructor(dataSource: DataSource, options: MigrationsOptions); runMigrations(options: RunMigrationsOptions): Promise<{ pendingQueryExecuted: QueryExecution[]; newQueryExcuted: QueryExecution[]; }>; private generateMigrationFileContents; private executeMigrationFileContents; private getAlreadyRunMigrations; private insertRunMigration; private createMigrationsTableIfNotExists; private hasSomeEntityTables; }