Skip to content

Allow schema changes in diffs#252

Open
dvdkon wants to merge 30 commits into
MerginMaps:masterfrom
dvdkon:schema-diff
Open

Allow schema changes in diffs#252
dvdkon wants to merge 30 commits into
MerginMaps:masterfrom
dvdkon:schema-diff

Conversation

@dvdkon

@dvdkon dvdkon commented May 22, 2026

Copy link
Copy Markdown
Contributor

Currently we raise an error if the two databases being compared don't share the same schema. This PR adds new changeset entries and new code to work with databases with different schemata, capturing those schema differences in diffs.

Currently missing:

  • Decide on rebase conflict reporting (JSON vs exceptions).
  • Add documentation on new entries, diffing principles, and limitations.
  • Postgres support (likely in separate PR)

The C GEODIFF_CE_* API functions were updated to support the new entries. This means that GEODIFF_CE_operation will return the new type values and all other CE functions will return NULL for the new entries. On the Python side it's similar, ChangesetEntry for schema change entries will not contain old_values, new_values or table.

Skipping the schema change entries in this API was also considered, but I think this leads to a cleaner API, at the cost of some old code crashing in non-dangerous ways, if it wasn't already checking for NULLs. The alternate approach would require adding a new API or some dynamic flag for at least checking that schema change entries are present.

@dvdkon
dvdkon force-pushed the schema-diff branch 4 times, most recently from cdcfeb4 to d4504be Compare May 22, 2026 11:26
@dvdkon
dvdkon marked this pull request as ready for review May 26, 2026 11:03
@dvdkon
dvdkon force-pushed the schema-diff branch 2 times, most recently from adc0426 to 9be2318 Compare June 12, 2026 08:49
dvdkon added 15 commits July 15, 2026 11:21
Previously when reading entries, there was only one instance of
ChangesetTable kept inside the reader, which would get overwritten on a
new entry. This is fast when processing entries sequentially, but
complicates/slows down the not-uncommon case of keeping entries around
for longer.
Assisted-by: Claude Sonnet 4.6
We now explicitly support these schema changes.
The previously unsupported change is now supported.
@dvdkon

dvdkon commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

I had Fable review the PR and fixed the most important issues. The full review is here:
REVIEW.md. I'll get to fixing or explicitly ignoring the rest later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant