postgres-schema-ts icon indicating copy to clipboard operation
postgres-schema-ts copied to clipboard

Feature Request: Reflection on Indexes & Constraints

Open sitch opened this issue 3 years ago • 0 comments

Would be useful to extract additional info from constraints and indexes.

For instance:

CREATE UNIQUE INDEX <NAME> ON <CONTEXT>.<TABLE> USING <INDEX_METHOD> (<COLUMN>)

Allows you to extract that <CONTEXT>.<TABLE>.<COLUMN> is unique -- can just add a JSDoc comment about uniqueness or a type alias.

https://www.postgresql.org/docs/current/ddl-constraints.html

Additionally, by either reflecting on explicit constraints or <TABLE>_<FOREIGN_KEY> you can infer that there are assoc relationships.

sitch avatar Feb 07 '22 23:02 sitch