Skip to main content
The Environment Diff compares the database schemas of two environments side by side. Use it before a merge to see exactly what would flow from source to target, or to audit drift between any two environments. The diff engine introspects both environments’ schemas, runs a forward-only comparison, and generates the SQL needed to bring the target up to date. Environment schema diff comparison

How the diff works

Three stages, all server-side:

Forward-only semantics

The engine compares source against target asymmetrically. Specifically:
  • Objects in source but not target → shown as CREATED. They need to be created in the target.
  • Objects in both → compared field by field. Differences are flagged as modifications.
  • Objects only in targetnot shown as DROPPED.
The third rule is the key design decision. If a table exists only in the target, it was never present in the source — labeling it TABLE_DROPPED would suggest an intentional drop happened in the source. The diff focuses on changes that originated in the source and need to flow to the target. Exception — for column-level changes within a table that exists in both environments, COLUMN_DROPPED is detected, because that’s an actual column-removal operation performed on the source.

Change types

*Type narrowing (textvarchar(50), int8int4) is breaking — it can lose data. Type widening (varchartext) is safe. TABLE_DROPPED, ENUM_DROPPED, and VIEW_DROPPED aren’t generated at the top level — see forward-only semantics above.

Cherry-pick selection

The diff view supports selecting individual changes for a subsequent merge:
  • Tick or untick each change individually.
  • Use the group checkbox on a table to select or deselect all changes for that table at once.
  • Breaking changes are not pre-selected by default. You have to explicitly opt in to drops, type narrowing, and enum-value removals — protection against accidental data loss.
The selection set is what flows into the merge. Anything you leave unticked stays in the source.

Reading the diff output

Each entry in the diff has these fields:

Use cases

Running the diff via GraphQL

The summary block is a quick at-a-glance view; changes carries the detail.

FAQ

Forward-only semantics. A table that exists only in the target was never in the source, so describing it as “dropped” would be misleading. Drops are surfaced at the column level only, where they reflect an actual removal that happened in the source.
A change that may cause data loss or break consumers of the API. Drops, narrowing type changes, removing enum values, and removing relationships are flagged as breaking. They’re never pre-selected for merge — you have to opt in.
The diff is pairwise. To compare three environments, run two diffs and reconcile. Most workflows compare a feature branch against staging and staging against master independently.
Schema only — tables, columns, indexes, enums, views, relationships. Data differences aren’t surfaced; the diff is about structural drift, not row counts.
Both environments must be in active status. Diffs against environments in branching, merging, or error state are rejected — the schemas may not be in a consistent state to compare.