pgschema icon indicating copy to clipboard operation
pgschema copied to clipboard

Feature request: stable order of lines in main.sql in multifile mode

Open marcintustin opened this issue 1 year ago • 3 comments

It would be nice to have the lines in main.sql have a stable order so that changes in the order of the lines reflect a change in the contents of the database. I'm under the impression that right the order of lines is arbitrary (presumably subject to dependencies between the files).

Because there may be dependencies between the files, I assume this isn't as trivial to do as so request.

marcintustin avatar Sep 30 '25 17:09 marcintustin

As you mentioned, this is non-trivial. pgschema maintains its own canonical format. Both order-wise or feature-wise (e.g. there are multiple ways to specify a unique key). What pgschema tries to achieve is to make the canonical format more intuitive so that users are more likely follow it.

tianzhou avatar Sep 30 '25 17:09 tianzhou

Sounds like you wouldn't necessarily be against this if I implemented it though (don't hold your breath)

marcintustin avatar Sep 30 '25 20:09 marcintustin

This is a desired behavior, if you have a good idea to implement without introducing too much complexity, happy to discuss here.

tianzhou avatar Oct 01 '25 02:10 tianzhou