Skip to content

Harden v2 schema hashing: capture more schema detail and fix determin…#4

Open
zachtbeer wants to merge 2 commits into
mainfrom
zb/v2-prep
Open

Harden v2 schema hashing: capture more schema detail and fix determin…#4
zachtbeer wants to merge 2 commits into
mainfrom
zb/v2-prep

Conversation

@zachtbeer

@zachtbeer zachtbeer commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

What changed

Hardened the v2 schema hash so it stops missing real schema changes and stops producing different hashes for the same schema on different machines.

Schema details it now actually hashes (these used to slip through as identical):

  • Computed column formulas and whether they're persisted
  • Filtered index WHERE predicates
  • Foreign key referenced table and column
  • Default constraint target column
  • Index key sort order (ASC/DESC) and INCLUDE columns

Determinism fixes:

  • All sorting is ordinal now, so the hash doesn't depend on machine culture
  • Ints are serialized little-endian explicitly instead of host byte order
  • Identity detection works for table names with dots
  • Uses HASHBYTES on Azure SQL instead of falling back to weak CHECKSUM
  • ObjectNamesToIgnore now filters UDTs too, not just tables and procs

Options:

  • Added V1, V2, and Structural presets (V2 is the new Default)
  • Added IgnoreIndexNames, IgnoreIndexSortOrder, and IgnoreSysDiagramObjects toggles

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