tldr; I have a ton of Enums in my pretty schema but now Hasura tells me they want tables instead! Here is a script #regexForTheWin
Why?
Hasura recommends Tables
versus Enum
types see why here
How it works.js
Given a sql string with CREATE TYPEs. .. in it, convert them to CREATE TABLE.
Don't forget
Tell hasura to use those tables as enum tables and don't forget to update the fields that used to reference your enums by pointing to the table and adding foreign keys. For example:
ALTER TABLE myschema.users ADD CONSTRAINT
myschema."usersStatus_fkey" FOREIGN KEY (status) REFERENCES myschema."Status";
Top comments (0)