stripe / pg-schema-diff

Go library for diffing Postgres schemas and generating SQL migrations
MIT License
348 stars 25 forks source link

Find Clean Solution to Diffing Hierarchies #63

Open bplunkett-stripe opened 1 year ago

bplunkett-stripe commented 1 year ago

Diffing hierarchies like indexes is pretty gross right now. If the parent index is re-created, we need to push that re-create down to the child indexes. There's no good way of doing this, so we're forced to use a hackaround where when diffing the child indexes we:

  1. Use the old and new schema map to fetch the old and new parent
  2. Diff the old and new parent to figure out if we need to re-create them