Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new type_differs predicate can miss alter-type cases (e.g., interval qualifiers/collation), potentially causing migrations to attempt ALTER COLUMN ... TYPE while dependent views still exist.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR addresses #242 by making view-drop decisions column-aware (including materialized views) so that unrelated table changes (e.g., ADD COLUMN) no longer force unnecessary DROP MATERIALIZED VIEW + full rebuilds.
Changes:
- Add
View::column_relationto dumps (sourced frompg_dependon the view’s_RETURNrule) to track per-column dependencies. - Update
Comparer::dependent_view_keysto drop views only when a referenced table is dropped/recreated or when a view reads a dropped/retyped column. - Add fixtures, Rust tests, and a CI assertion to prevent regressions where unread-column changes drag views along.
File summaries
| File | Description |
|---|---|
app/src/comparer/core.rs |
Switch dependency detection from table-level to column-level for view dropping. |
app/src/dump/core.rs |
Extend view dump SQL to include column_relation collected from pg_depend. |
app/src/dump/view.rs |
Add optional column_relation field to the View dump model (excluded from view hash). |
app/src/dump/table_column.rs |
Introduce type_differs helper for determining “retype” changes. |
app/src/dump/table.rs |
Reuse type_differs for partition recreate gating to keep predicates aligned. |
app/src/comparer/tests/core/view_column_dependencies.rs |
Add focused tests for “unread column change should not drop/rebuild views” behavior. |
app/src/comparer/tests/core.rs |
Wire the new test module into the test suite. |
data/test/schema_a.sql |
Add FROM fixture objects for issue #242 reproduction. |
data/test/schema_b.sql |
Add TO fixture objects for issue #242 reproduction. |
data/test/README.md |
Document the new #242 guard and why round-2 diffs can’t catch it. |
.github/workflows/rust.yml |
Add a CI grep-based assertion against the round-1 script to catch over-eager view drops. |
CHANGELOG |
Document the #242 fix and dump format change (optional field). |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🔵 Needs a closer look
There are a couple of small but concrete issues in the updated docs/CI check (including a regex that can match unintentionally) that should be corrected before approval.
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
.github/workflows/rust.yml:201
- The grep pattern uses
test_schema.${v}in an ERE, where.is a wildcard; this can match unintended strings and make the CI check flaky. Escape the dot (and optionally anchor/require the trailing semicolon) so the match is exact.
app/src/dump/table_column.rs:387 - The doc comment
/// Hashnow sits ontype_differs, but this method isn’t a hashing routine. This makes the generated docs misleading; rename this line to describe the predicate (or remove it) so it reflects what the method actually does.
- Files reviewed: 12/12 changed files
- Comments generated: 0 new
- Review effort level: Lite
Closes #242