/** * Apply ordered state SQL to a shadow database; collect all errors; COMMIT only if none. */ import type { Client } from 'pg'; import type { IStateApplyFile } from '../../types/apply'; import { type TShadowCatalogLayout } from '../migrate/stateApplyRouting'; export interface IShadowApplyError { file: string; message: string; code?: string; possiblyCascading: boolean; } export interface IShadowApplyResult { success: boolean; errors: IShadowApplyError[]; } export interface IShadowApplyOptions { /** Schema for tables/enums/indexes (and all objects when same-database layout). */ shadowSchema: string; /** Production catalog schema (from env / DB_SCHEMA). */ targetSchema: string; layout: TShadowCatalogLayout; } /** * Drop and recreate a non-public schema so each diff starts from a clean catalog. * Used when shadow and target share one database (different schema names): refusing * `public` here protects the real target data that lives in the shared database. */ export declare const resetShadowSchema: (client: Client, schema: string) => Promise; /** * Drop and recreate a schema on a disposable shadow database (`--shadow-url` / * `DDP_SHADOW_DATABASE_URL`). Unlike `resetShadowSchema`, this allows `public`: the * connection is a separate database instance with no real data, so wiping it is safe * even when the shadow schema name mirrors the target schema name (often `public`). */ export declare const resetShadowSchemaUnchecked: (client: Client, schema: string) => Promise; /** * Per-file SAVEPOINT: try each file; on failure roll back that file only and record. * If any failures: ROLLBACK entire transaction (shadow unchanged). Else COMMIT. * * Layout: * - separate-database: schema → shadowSchema; procs/triggers → targetSchema (production shape). * - same-database: everything → shadowSchema only (does not mutate target during diff). */ export declare const applyStateFilesToShadowWithAggregateErrors: (client: Client, files: IStateApplyFile[], options: IShadowApplyOptions) => Promise; //# sourceMappingURL=shadowApply.d.ts.map