import { DbAdapter } from './adapter'; import { Commit } from './git'; export declare type TaskType = 'up' | 'down'; export declare class MigrationLoadError extends Error { migration: Migration; migrationDir: string; error: any; constructor(migration: Migration, migrationDir: string, error: any); } export declare class FirstDownMigrationError extends Error { migration: Migration; constructor(migration: Migration); } export declare class MigrationRunTwiceError extends Error { migration: Migration; type: 'up' | 'down'; constructor(migration: Migration, type: 'up' | 'down'); } export declare class MigrationNotFoundError extends Error { migration: Migration; migrationDir: string; constructor(migration: Migration, migrationDir: string); } export declare class TaskTypeNotFoundError extends Error { migration: Migration; taskType: TaskType; migrationDir: string; constructor(migration: Migration, taskType: TaskType, migrationDir: string); } export declare class MigrationExecutionError extends Error { original: any; constructor(original: any); } export declare class UnknownTaskTypeError extends Error { constructor(type: string); } export declare class Migration { /** The name of the migration */ name: string; constructor( /** The name of the migration */ name: string); /** * @param migrationDir The migration directory */ getPath(migrationDir: string): Promise; } export declare class TaskList extends Array { /** * Converts the task list to a string of commands that can be embedded in a commit message */ toString(withComment?: boolean): string; execute(migrationDir: string, adapter: DbAdapter, head?: Commit, commit?: Commit): Promise; } export declare class Task { /** The sequential id of the task entry in the database */ id: number | undefined; /** The function that was executed */ type: TaskType; /** The migration that was run */ migration: Migration; /** The commit that triggered the task, if triggered by a commit */ commit?: Commit; /** The git HEAD at the time the task was executed */ head?: Commit; /** The date when the migration was applied if already executed */ appliedAt?: Date; constructor(options: { id?: number; type: TaskType; migration: Migration; commit?: Commit; head?: Commit; appliedAt?: Date; }); invert(): Task; /** * Executes the task * @param migrationDir the fallback folder to search the migration in if no merkelrc can be found */ execute(migrationDir: string, adapter: DbAdapter, head?: Commit, commit?: Commit): Promise; /** * Converts the task to a short string including the type and migration name that can be shown * in the CLI */ toString(): string; }