stripe / pg-schema-diff

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

Add support for fetching non-public schemas. #96

Closed bplunkett-stripe closed 8 months ago

bplunkett-stripe commented 8 months ago

Description

This only adds support for fetching non-public schemas. This does actually allow generating migration plans for non-public schemas because we will need plumb several into the sql generation code to account for schemas.

I opted to do the filtering in-memory because it is way more flexible to do the filtering in-memory rather than in the queries. We can easily support things like regex and complex nested operations in the future (unions of intersections, etc). I don't expect the filters to significantly reduce the number of schema objects being fetched, so the performance impact of doing it in-memory is minimal.

Motivation

https://github.com/stripe/pg-schema-diff/issues/94

Testing

Tested via unit tests