Skip to content

0.20.9 — cross-package reference binding + dependent-view rebuild (#243, #244)

Choose a tag to compare

@dmealing dmealing released this 28 Jul 23:32
· 1353 commits to main since this release

npm-only patch (14-package lockstep; PyPI/NuGet/Maven Central unchanged). Fixes found while hardening the D1 migrate path.

#244 — cross-package references bind by fully-qualified name. When two packages declared a same-bare-named object.entity, a fully-qualified @references / projection origin.passthrough @from / @via silently bound the wrong package's entity, load-order-dependent — a foreign key against the wrong table (silent) and/or a projection view whose JOIN read the wrong table (fails at apply). Both the schema builder (migrate-ts, FK targets) and the projection view-spec (codegen-ts, @from/@via/@of/extends join resolution) now resolve package-aware via the loader's resolveObjectRef/resolutionKey() contract. Generated view SQL is byte-identical for existing single-package models. Plus a build-time ERR_DUPLICATE_SQL_NAME guard when two distinct objects generate the same database name.

#243 — a dependent view over a rebuilt table is no longer stranded. On SQLite/D1 a table rebuilt for a CHECK/FK/enum-@values change (or pulled into the D1 FK-cascade as a referrer) left a view reading it dangling across the DROP/RENAME, failing at apply. The diff now drops/recreates dependent views for the full recreate-trigger class, and the D1 cascade owns the view drop/recreate in-order (no double-emit). Postgres unaffected.

Each half reproduced on a real engine before fixing. See CHANGELOG.md [0.20.9].