Commit 3f33d86
fix(migrate): offline --allow adopt-view drop+creates a structural projection change (#240)
Follow-up to #239. The 0.20.4 fix keyed the legal/illegal CREATE OR REPLACE decision on
BOTH column sets being known. But the OFFLINE (snapshot-based) migrate path diffs against a
pre-fingerprint snapshot that records NO view columns, so `actual.columns` is undefined and
the adopt branch fell back to a non-destructive replace-view — an illegal CREATE OR REPLACE
for a projection whose desired shape is fully known (structural change → rejected at apply).
The decision now keys on the EXPECTED (desired) view's columns only: a known projection runs
`viewReplaceIsLegal`, which fail-safes to `false` (→ drop+create) when the actual columns are
unknown too — exactly the offline adopt case. An opaque `@sql` body (expected columns unknown)
still keeps its non-destructive replace on adoption (#208). #239 online + real-PG round-trip
and the #208 @SQL adopt (view-lifecycle-pg 17/17) are unchanged.
Diagnosed by reproducing the offline path: buildProjectionViews/buildExpectedSchema DO
populate expected columns; it's the snapshot ACTUAL side that lacks them.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014xy8powhHYJ6gfFt9Ut8dL1 parent 6cf9f15 commit 3f33d86
3 files changed
Lines changed: 51 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
8 | 24 | | |
9 | 25 | | |
10 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
623 | 628 | | |
624 | | - | |
| 629 | + | |
625 | 630 | | |
626 | 631 | | |
627 | 632 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
215 | 237 | | |
216 | 238 | | |
217 | 239 | | |
| |||
0 commit comments