Safe Haskell | None |
---|---|
Language | Haskell2010 |
Types and functions for interacting with and manipulating SQL enums represented by single-column tables, not native Postgres enum types. Native enum types in Postgres are difficult to change, so we discourage their use, but we might add support for native enum types in the future.
Synopsis
- resolveEnumReferences :: forall b. Backend b => HashMap (TableName b) (PrimaryKey b (Column b), TableConfig b, EnumValues) -> HashSet (ForeignKey b) -> HashMap (Column b) (NonEmpty (EnumReference b))
Documentation
resolveEnumReferences :: forall b. Backend b => HashMap (TableName b) (PrimaryKey b (Column b), TableConfig b, EnumValues) -> HashSet (ForeignKey b) -> HashMap (Column b) (NonEmpty (EnumReference b)) Source #
Given a map of enum tables, computes all enum references implied by the given set of foreign keys. A foreign key constitutes an enum reference iff the following conditions hold:
- The key only includes a single column.
- The referenced column is the table’s primary key.
- The referenced table is, in fact, an enum table.