pgschema icon indicating copy to clipboard operation
pgschema copied to clipboard

Feature: support subsets of a schema

Open marcintustin opened this issue 1 year ago • 7 comments

Right now pgschema wants to manage all the objects in a schema. If an object is missing from pgschema’s local schema file pgschema generates a drop.

This is all very well and very terraform, but it prevents incremental adoption of pgschema.

One way to handle this would be to add a flag to not generate drops for those objects missing from the local schema files.

This doesn’t however address the use case of continual syncing. I would prefer the approach of a .pgignore file that lists object to leave alone. Ideally paired with an ignore command to ignore objects (add to the file) or to add all the objects defined in a file to the ignore file.

I know that’s a lot of idea, thanks for considering this!

marcintustin avatar Sep 13 '25 11:09 marcintustin

@marcintustin will table level filter sufficient?

tianzhou avatar Sep 13 '25 13:09 tianzhou

I’d say all objects, such as views, functions, and procedures should be ignorable. Obviously more granular ignores, eg for a field would be pretty crazy.

Marcin Tustin

On Sat, Sep 13, 2025 at 09:09 Tianzhou @.***> wrote:

tianzhou left a comment (pgschema/pgschema#24) https://github.com/pgschema/pgschema/issues/24#issuecomment-3288339300

@marcintustin https://github.com/marcintustin will table level filter sufficient?

— Reply to this email directly, view it on GitHub https://github.com/pgschema/pgschema/issues/24#issuecomment-3288339300, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJOUOHFWFA3ZOYQCBVZ7ET3SQJRZAVCNFSM6AAAAACGNF42D2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBYGMZTSMZQGA . You are receiving this because you were mentioned.Message ID: @.***>

marcintustin avatar Sep 13 '25 13:09 marcintustin

@marcintustin do you have a concrete use case requiring more granular ignore than table? If so, do you have some thoughts about how to specify them?

tianzhou avatar Sep 13 '25 13:09 tianzhou

I’d like to be able to ignore top level objects like tables, views, functions, procedures, and types. I can’t think of a use case for more granular ignores than that.

The use case for ignoring those objects is basically that we have a public schema that contains our new, well designed stuff, and legacy manually compiled stuff as well as the procedures to transform the one into the other. I’d like to only manage the new stuff initially, and gradually eliminate the old stuff.

Marcin Tustin

On Sat, Sep 13, 2025 at 09:41 Tianzhou @.***> wrote:

tianzhou left a comment (pgschema/pgschema#24) https://github.com/pgschema/pgschema/issues/24#issuecomment-3288374987

@marcintustin https://github.com/marcintustin do you have a concrete use case requiring more granular ignore than table? If so, do you have some thoughts about how to specify them?

— Reply to this email directly, view it on GitHub https://github.com/pgschema/pgschema/issues/24#issuecomment-3288374987, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJOUOA6CRVI2CSW533RZJL3SQNHHAVCNFSM6AAAAACGNF42D2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBYGM3TIOJYG4 . You are receiving this because you were mentioned.Message ID: @.***>

marcintustin avatar Sep 13 '25 16:09 marcintustin

@marcintustin thank you. This is helpful. Let me think about how to support this.

tianzhou avatar Sep 14 '25 09:09 tianzhou

🙏

Marcin Tustin Tel: +1 917 553 3974

On Sun, Sep 14, 2025 at 05:09 Tianzhou @.***> wrote:

tianzhou left a comment (pgschema/pgschema#24) https://github.com/pgschema/pgschema/issues/24#issuecomment-3289374369

@marcintustin https://github.com/marcintustin thank you. This is helpful. Let me think about how to support this.

— Reply to this email directly, view it on GitHub https://github.com/pgschema/pgschema/issues/24#issuecomment-3289374369, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJOUOCRHEZJ5WRMQSU3YG33SUWDHAVCNFSM6AAAAACGNF42D2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBZGM3TIMZWHE . You are receiving this because you were mentioned.Message ID: @.***>

marcintustin avatar Sep 14 '25 12:09 marcintustin

Implemented. Please see https://www.pgschema.com/cli/ignore

tianzhou avatar Sep 15 '25 17:09 tianzhou