import type { SchemaSnapshot } from "../types.js"; /** A rebuilt table that cannot be rebuilt on D1 because a foreign key targets it. */ export interface D1RebuildRefusal { /** The table being rebuilt. */ table: string; /** Tables whose foreign key targets `table` (includes `table` itself for a self-reference). */ referencedBy: string[]; } /** * Of the tables being rebuilt (recreate-and-copy), which are the target of a foreign * key in the expected schema? On remote D1 the rebuild recipe's `PRAGMA foreign_keys * = OFF` is a no-op inside D1's implicit transaction, so `DROP TABLE` of a referenced * table fails with "FOREIGN KEY constraint failed" (#226). Detection uses the target * (expected) schema and errs toward refusing. */ export declare function findReferencedRebuilds(recreatedTables: ReadonlySet, expectedSchema: SchemaSnapshot): D1RebuildRefusal[]; /** Thrown at generation time when a D1 migration would rebuild an FK-referenced table. */ export declare class D1ReferencedTableRebuildError extends Error { readonly refusals: D1RebuildRefusal[]; constructor(refusals: D1RebuildRefusal[]); } /** * Thrown when a D1 FK-cascade rebuild (#241) cannot be ordered because the * affected tables form a multi-table foreign-key cycle. Unlike the acyclic case * (which the cascade emitter rebuilds via `PRAGMA defer_foreign_keys = ON`), a * cycle has no parents-first order, so the rebuild is refused at generation time. */ export declare class D1CyclicForeignKeyError extends Error { readonly cycle: string[]; constructor(cycle: string[]); } //# sourceMappingURL=d1-fk-refuse.d.ts.map