import type { DetectedSchema, MigrationCommand } from "./detect-schema.ts";
export interface ApplyMigrationsOptions {
    /** Application root the build runs in; also the CLI working directory. */
    appPath: string;
    /** Connection used for migrations: the direct/admin database URL. */
    databaseUrl: string;
    /** Auto-detected from `appPath` when omitted. */
    schema?: DetectedSchema;
    /** Extra environment for the CLI child, e.g. a user-set `DIRECT_URL`. */
    env?: Record<string, string>;
    signal?: AbortSignal;
    onLog?: (line: string, stream: "stdout" | "stderr") => void;
}
export type ApplyMigrationsResult = {
    applied: true;
    via: MigrationCommand;
} | {
    applied: false;
    reason: "no-schema";
};
/**
 * Last resort for repos that ship a schema with no prisma installed at all.
 * Pinned to the 6.x line: Prisma 7 rejects the classic `url = env(...)`
 * datasource form (P1012), which is exactly the schema shape such repos have.
 * Bump deliberately, never to `latest`.
 */
export declare const FALLBACK_PRISMA_CLI_VERSION = "6.19.3";
export interface CliLauncher {
    command: string;
    argsPrefix: string[];
    /** Human-readable command prefix used in failure messages. */
    display: string;
}
/**
 * Applies the app's schema and returns how it was applied, or `no-schema`
 * when the app has none. Throws {@link BuildError} on failure: a non-zero
 * CLI exit carries `exited with code N` (a user-fixable error), while an
 * unrunnable launcher does not (an infrastructure error).
 */
export declare function applyMigrations(opts: ApplyMigrationsOptions): Promise<ApplyMigrationsResult>;
/**
 * Resolves the launcher ladder for a schema's engine: the project's own
 * binary first (run via `node`), then download fallbacks tried in order when
 * the binary is not installed.
 */
export declare function resolveSchemaEngineCli(schema: DetectedSchema, appPath: string, signal?: AbortSignal): Promise<CliLauncher[]>;
/**
 * Runs `subcommand` against the launcher ladder, falling through to the next
 * launcher when one cannot run (spawn ENOENT or exit 127) and throwing on the
 * first launcher that runs the tool to a real non-zero exit.
 */
export declare function runWithLaunchers(opts: {
    launchers: CliLauncher[];
    subcommand: string[];
    subcommandDisplay: string;
    cwd: string;
    env: NodeJS.ProcessEnv;
    signal?: AbortSignal;
    onLog?: (line: string, stream: "stdout" | "stderr") => void;
}): Promise<void>;
//# sourceMappingURL=apply-migrations.d.ts.map