postgres-schema-ts
postgres-schema-ts copied to clipboard
Feature Request: Reflection on Indexes & Constraints
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.