Commit ee7b756
refactor(views): unify view DDL into the single schema-diff path
The schema-diff now owns ALL view DDL for every dialect, replacing the
parallel computeProjectionMigrations / source-aware-diff emitter. One
generator (emitViewDdl via buildProjectionViews) produces every CREATE
VIEW; the diff produces create/drop/replace plus a dependency-recreate
pass; each dialect renderer emits it.
- migrate-ts: port view rendering into the sqlite/d1 emitter, drop the
postgres-only guard; add diff Pass 2c (drop+recreate a view around a
column-altering change to a table it reads), driven by a new
ViewDescriptor.dependsOn; sqlite STAGE_ORDER drop-view=0 (before the
recreate-and-copy, mirroring postgres); introspectD1 reads view bodies.
- codegen-ts: buildProjectionViews is the single expected-view source
(name/body/schema/dependsOn); emitViewDdl gains bodyOnly; resolve JOIN
FK/PK to physical columns (naming strategy + @column) instead of a
hardcoded snake_case guess; quote identifiers that need it so literal/
kebab columns survive postgres case-folding.
- cli: emit all diff changes (tables + views) through one path; delete
computeProjectionMigrations + the view-diff stack.
Deletes source-aware-diff, view-diff, view-ddl-{postgres,sqlite},
expected-views, projection-migrations and their tests; removes the
corresponding migrate-ts barrel exports.
Validated: full unit suites green, postgres persistence-conformance
(incl. a new recreate-view-on-column-type-change scenario), and a live
from-empty platform migrate emitting exactly one correct CREATE VIEW.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 61493b1 commit ee7b756
43 files changed
Lines changed: 742 additions & 1269 deletions
File tree
- fixtures/persistence-conformance/migrations
- states
- program-view-v1
- program-view-v2
- server/typescript/packages
- cli
- src
- commands
- lib
- test/unit
- codegen-ts
- src
- projection
- test/projection
- integration-tests/src
- migrate-ts
- src
- diff
- drift
- emit
- introspect
- snapshot
- test
- unit
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments