/** * MigrationRunner for `@atlex/orm`. * * Discovers migration files, tracks state in the `migrations` table (common convention), and runs * migrations in batches with transactional safety. */ import type { Connection } from '../Connection.js'; export interface MigrationContext { connection: Connection; } export interface MigrationModule { up: (ctx: MigrationContext) => Promise | void; down: (ctx: MigrationContext) => Promise | void; } export interface MigrationStatusRow { migration: string; batch: number | null; ran: boolean; } export interface MigrationRunnerConfig { migrationsPath: string; connectionName?: string; /** Table that stores ran migrations. @default "migrations" */ migrationsTable?: string; } export interface MigrateRunResult { ran: string[]; batch: number; /** True when the migrations table was created on this run (`migrate:install`). */ migrationTableCreated: boolean; } export declare class MigrationRunner { private readonly conn; private readonly migrationsPath; private readonly migrationsTable; constructor(config: MigrationRunnerConfig); /** * Ensure the migrations tracking table exists. * * @returns `true` if the table was created, `false` if it already existed. */ ensureMigrationsTable(): Promise; /** * Get migration status for all files discovered. */ status(): Promise; /** * Run all pending migrations. */ migrate(): Promise; /** * Roll back the last batch. */ rollback(): Promise<{ rolledBack: string[]; batch: number | null; }>; /** * Roll back all migrations. */ reset(): Promise<{ rolledBack: string[]; }>; /** * Refresh migrations: reset + migrate. */ refresh(): Promise; /** * Drop all tables and re-run all migrations. */ fresh(): Promise; private runSingleMigration; private importMigration; private nextBatchNumber; private lastBatchNumber; private getRanMigrations; private getPendingMigrations; private findMigrationFileByName; private discoverMigrationFiles; } //# sourceMappingURL=MigrationRunner.d.ts.map