Skip to content

D1: dependent view over a cascade-rebuilt table isn't drop/recreated (Pass 2c gap) #243

Description

@dmealing

Follow-up from #241.

Problem

The diff layer's Pass 2c injects a view drop/recreate pair only for column-altering changes (change-column-*, drop-column, rename-column) via VIEW_RECREATE_TRIGGERS (src/diff/index.ts). It does not cover CHECK/foreign-key/field.enum-values rebuilds, and it has no knowledge of the #241 emit-layer FK cascade's referrer expansion.

Consequences on SQLite/D1:

Scope

Narrow (a D1 projection/view over an FK-referrer, with a check/FK/enum rebuild upstream), but it means the #241 docs' "applies cleanly against a populated production database" claim has a known exception (now qualified in the docs).

Fix direction

Extend the dependent-view drop/recreate to the full set of tables a migration rebuilds — including check/FK/enum rebuilds and the cascade-affected (referrer) set — not just column-altering changes. This is a diff-layer change and needs its own real-engine gate (view survives a check/FK-triggered rebuild of the base table, and of an FK referrer). Intentionally NOT bundled into the #241 patch to avoid an unproven diff-layer change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions