Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres enum import not fetching values with Prisma #445

Open
ghost opened this issue Nov 23, 2023 · 0 comments
Open

Postgres enum import not fetching values with Prisma #445

ghost opened this issue Nov 23, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Nov 23, 2023

Describe the bug
Hi team, love your work. It's very close to saving us a lot of time - we're just running into a small issue.

We generate enums in Postgres with Prisma. You can see the type in information_schema.columns below.

To Reproduce

  1. Schema (if applicable)
table_schema             | public
table_name               | AllergyIntolerance
column_name              | clinicalStatus
ordinal_position         | 3
column_default           |
is_nullable              | NO
data_type                | USER-DEFINED
character_maximum_length |
character_octet_length   |
numeric_precision        |
numeric_precision_radix  |
numeric_scale            |
datetime_precision       |
interval_type            |
interval_precision       |
character_set_catalog    |
character_set_schema     |
character_set_name       |
collation_catalog        |
collation_schema         |
collation_name           |
domain_catalog           |
domain_schema            |
domain_name              |
udt_schema               | public
udt_name                 | AllergyIntoleranceClinicalStatus
scope_catalog            |
scope_schema             |
scope_name               |
maximum_cardinality      |
dtd_identifier           | 3
is_self_referencing      | NO
is_identity              | NO
identity_generation      |
identity_start           |
identity_increment       |
identity_maximum         |
identity_minimum         |
identity_cycle           | NO
is_generated             | NEVER
generation_expression    |
is_updatable             | YES

The values exist in psql:

ubuntu=# \dT+ "AllergyIntoleranceClinicalStatus"
List of data types
-[ RECORD 1 ]-----+-----------------------------------
Schema            | public
Name              | "AllergyIntoleranceClinicalStatus"
Internal name     | AllergyIntoleranceClinicalStatus
Size              | 4
Elements          | active                            +
                  | inactive                          +
                  | resolved
Owner             | postgres
Access privileges |
Description       |
  1. For some reason it correctly identifies a categorical field but doesn't fetch the values.
...
    "clinicalStatus": {
      "type": "string",
      "categorical": {}
    },
...

Expected behavior
We would expect the imported schema file to look like

...
    "clinicalStatus": {
      "type": "string",
      "categorical": {"active", "inactive", "resolved"}
    },
...

Environment (please complete the following information):

  • OS: MacOS
  • Version: synth 0.6.9
@ghost ghost added the bug Something isn't working label Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

0 participants