Skip to content

Expand integration test fixtures (schema_a/schema_b) to close diff-coverage gaps #205

@nettrash

Description

@nettrash

The data/test/schema_a.sqldata/test/schema_b.sql fixtures already cover the heavy machinery very well (partitions, persistence chains, virtual generated columns, CASCADE dependents, and every regression case from #180, #181, #186, #188, #191, #200, #202). However, a coverage audit against app/src/dump/ and app/src/comparer/core.rs surfaced a long tail of attribute-level diffs on otherwise-covered object kinds that are never exercised by CI.

CI runs the fixtures end-to-end against a real Postgres (.github/workflows/rust.yml), so each addition exercises the full dump→compare→apply pipeline.

High-priority gaps (verified absent via grep)

  • GRANT privilege bits DELETE, TRUNCATE, REFERENCES, TRIGGER are never tested. Only SELECT, INSERT, UPDATE, EXECUTE, USAGE, CREATE appear in either schema. Add one table where schema_a has GRANT DELETE, TRUNCATE, REFERENCES, TRIGGER and schema_b drops one + adds another, so the diff exercises all four privilege-bit paths.
  • No BRIN or HASH indexes. Only BTREE, GIN, and GIST are present. Add one BRIN index on an integer column (unchanged between A and B, to test dump round-trip) and one HASH index added in B (to test the create path).
  • No functional / expression indexes. All indexes are simple column indexes. Add a functional index like (lower(name)) in schema_a that either changes expression or is dropped in schema_b, plus a new functional index added in schema_b.
  • FK DEFERRABLE flag flip on a non-cycle FK is not tested. DEFERRABLE INITIALLY DEFERRED appears only in the cycle_a ↔ cycle_b pair (where it stays unchanged). Add a single non-cycle FK in schema_a without DEFERRABLE that becomes DEFERRABLE in schema_b — narrow but regression-prone area (recent Persistence-ordering silently emits arbitrary order on FK cycles #191).
  • DEFAULT drop direction is not tested. customers.name gains a DEFAULT 'unknown', but no column has a DEFAULT in A that is removed in B. Add a column that has DEFAULT in schema_a and NO DEFAULT in schema_b.

Lower-priority gaps

  • Index type change (e.g. BTREE → GIN) on the same column to exercise the drop-and-recreate path with a kind transition.
  • UNLOGGED sequence flip independent of table ownership — tables flip LOGGED↔UNLOGGED but sequences do not in isolation.
  • Function SUPPORT and TRANSFORM FOR TYPE clausesRoutine carries support_function and transform_types fields (app/src/dump/routine.rs) but no fixture exercises them. Narrow; rare in real schemas.

Out of scope (rejected as too narrow)

  • Owner changes on indexes (PostgreSQL doesn't really support distinct index ownership)
  • Overloaded function COST/ROWS where only one overload changes
  • FK MATCH FULL / MATCH SIMPLE modifier flips
  • View WITH CHECK OPTION / WITH LOCAL CHECK OPTION
  • Operator operand-order asymmetry

Acceptance

When this is closed, every checked item above should have a matching A→B diff in the fixtures, the data/test/README.md matrix should mention it, and cargo run -- --config ../data/test.conf against the loaded databases should produce a clean migration script that, when applied to the A database, makes it schema-equal to B.

Total additions estimated at ~30–80 lines across both schema files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions