import { DatabaseContext } from '../entity/db-context'; import { MigrationConfig, MigrationRunResult, LoadedMigration } from './migration.interface'; import { MigrationJournal } from './migration-journal'; import { MigrationLoader } from './migration-loader'; /** * Executes migrations against the database. * * The runner: * - Loads migration files from the configured directory * - Tracks applied migrations in a journal table * - Executes pending migrations in chronological order * - Supports rolling back migrations * - Runs each migration within a transaction for atomicity * * @example * ```typescript * const runner = new MigrationRunner(db, { * migrationsDirectory: './migrations', * verbose: true, * }); * * // Run all pending migrations * const result = await runner.up(); * console.log(`Applied ${result.applied.length} migrations`); * * // Rollback last migration * await runner.down(1); * ``` */ export declare class MigrationRunner { private db; private config; private journal; private loader; private verbose; private logger; constructor(db: DatabaseContext, config: MigrationConfig); private log; /** * Run all pending migrations in chronological order. * * If the journal table does not exist (fresh database), the schema is * created from the model definition first (diff-based), and all existing * migration files are recorded as applied. * * Each migration is executed within a transaction. If a migration fails, * the transaction is rolled back and execution stops. * * @returns Result containing applied, skipped, and failed migrations */ up(): Promise; /** * Revert the last N migrations in reverse chronological order. * * Each migration's down() method is executed within a transaction. * * @param count - Number of migrations to revert (default: 1) * @returns Result containing reverted migrations */ down(count?: number): Promise; /** * Get all pending migrations (not yet applied). */ getPending(): Promise; /** * Get all applied migrations. */ getApplied(): Promise; /** * Get the status of all migrations. * * @returns Array of migration status objects */ status(): Promise<{ filename: string; applied: boolean; appliedAt?: Date; }[]>; /** * Get the migration loader (for generating filenames, etc.) */ getLoader(): MigrationLoader; /** * Get the migration journal (for advanced operations) */ getJournal(): MigrationJournal; } //# sourceMappingURL=migration-runner.d.ts.map