Skip to content

Commit

Permalink
add pg enum to table conversion note
Browse files Browse the repository at this point in the history
  • Loading branch information
rikinsk committed Sep 2, 2019
1 parent e27edfd commit bbd22ef
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/graphql/manual/schema/enums.rst
Expand Up @@ -102,6 +102,16 @@ the following restrictions:
('moderator', 'Users with the privilege to ban users'),
('administrator', 'Users with the privilege to set users’ roles');
.. admonition:: Creating an enum table from a native PG enum

You can create a table containing the values of a PG enum by executing the following SQL:

.. code-block:: sql
CREATE TABLE "<my_enum_table>" (value TEXT PRIMARY KEY);
INSERT INTO "<my_enum_table>" (value) (SELECT unnest(enum_range(NULL::"<my_enum>")))::text);
Next, we need to tell Hasura that this table represents an enum.

Setting a table as an enum table
Expand Down

0 comments on commit bbd22ef

Please sign in to comment.