stripe / pg-schema-diff

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

Add basic `Extension` support. #43

Closed alexrhee-stripe closed 1 year ago

alexrhee-stripe commented 1 year ago

Description

We add basic extension support. This will allow declarative DDL sources to instruct the tooling to create, alter, and delete extensions so that other DDL statements dependent on these extensions are executable.

Note that the full gamut of extension DDL is not currently supported, namely the ability to target and move extensions across schemas. Insofar as the schema migration tooling assumes everything is on the public schema, I think this is OK for now and can be implemented in a later PR.

Motivation

We need extension support.

Testing

Unit tests were added and current tests were augmented. As a result of this change, we removed the onDbInitQueries hook since extensions are actually supported and would otherwise require adjusting every single test case. In its stead, I altered the internal/migration_acceptance_tests/function_cases_test.go to include a case with an extension known to create functions and we observe they are correctly ignored.

alexrhee-stripe commented 1 year ago

@bplunkett-stripe , thanks for the feedback! I think this is ready for another look.