Skip to content

goodm v0.6.0

Choose a tag to compare

@dwoolworth dwoolworth released this 25 Sep 02:39
· 13 commits to main since this release
19a756f

Fixed

  • Enforce now verifies the options of existing indexes instead of accepting any index by name alone. A goodm:"unique" field whose existing index is non-unique, sparse, or partial (and the reverse: a plain index field with a unique index) is reported as an EnforcementError by default. The same check applies to compound indexes. Previously such mismatches were silently skipped, so unique tags guaranteed nothing once any index of that name existed (MSA-76 / BUG-3136).

Added

  • EnforceOptions.IndexMismatchPolicy: IndexMismatchError (default, fail loudly), IndexMismatchRebuild (drop and recreate mismatched indexes; refuses to drop when rebuilding a unique index over duplicate data), and IndexMismatchIgnore (legacy name-only behavior).
  • IndexSpec type describing an existing index (keys, unique, sparse, partial).

Changed

  • Breaking: ListExistingIndexes now returns map[string]IndexSpec instead of map[string]bool.

Upgrade note

The default policy is now IndexMismatchError, so services whose databases already have drifted indexes will fail at boot with a descriptive EnforcementError until the index is rebuilt (or IndexMismatchRebuild/IndexMismatchIgnore is set). This loud failure is the point of the fix — the previous behavior silently left unique constraints unenforced.