import type { DesiredState, ActualState, DdlOperation } from './types.js'; /** * Compares a desired schema state against the actual database state and * produces a sorted list of DDL operations needed to reconcile the two. */ export declare class DiffEngine { /** Compute the full set of DDL operations to bring `actual` in line with `desired`. */ diff(desired: DesiredState, actual: ActualState): DdlOperation[]; /** Build all operations needed to create a brand new table (table + indexes + foreign keys + check constraints). */ private buildNewTableOperations; /** Generate the CREATE TABLE DDL for a table definition. */ private buildCreateTableOp; /** Compare an existing table against its desired definition and produce update operations. */ private diffTable; /** Detect added columns, type changes, and orphaned columns. */ private diffColumns; /** Detect indexes that need to be created. */ private diffIndexes; /** Detect foreign keys that need to be added. */ private diffForeignKeys; /** Detect CHECK constraints that need to be added. */ private diffCheckConstraints; /** Generate an ADD COLUMN operation. */ private buildAddColumnOp; /** Generate an ALTER COLUMN TYPE operation. */ private buildAlterColumnTypeOp; /** Generate a CREATE INDEX operation. */ private buildCreateIndexOp; /** Generate an ADD FOREIGN KEY constraint operation. */ private buildAddForeignKeyOp; /** Generate an ADD CHECK CONSTRAINT operation. */ private buildAddCheckConstraintOp; /** Produce a warning operation for a table that exists in the DB but not in the schema. */ private warnOrphanedTable; /** Produce a warning operation for a column that exists in the DB but not in the schema. */ private warnOrphanedColumn; /** Convert a column definition to its SQL fragment (e.g. `"name" TEXT NOT NULL DEFAULT 'x'`). */ private columnToSql; /** Check whether the column type has changed (case-insensitive comparison). */ private hasColumnTypeChanged; /** * Sort operations so they execute in a safe dependency order: * 1. CREATE TABLE (tables must exist before columns/indexes reference them) * 2. ADD COLUMN * 3. ALTER COLUMN TYPE * 4. CREATE INDEX (columns must exist first) * 5. ADD FOREIGN KEY (referenced tables must exist first) * 6. ADD CHECK CONSTRAINT (columns must exist first) * 7. Destructive operations (always last, require explicit opt-in) */ private sortByDependencyOrder; } //# sourceMappingURL=diff-engine.d.ts.map