P
Prisma2mo ago
RedRoss

How generete enum type from hasura?

No description
Solution:
If i understand your question correctly, Prisma actually does generate TypeScript types based on your database schema, which you can use in your application. See this section of the documentation
Jump to solution
7 Replies
RaphaelEtim
RaphaelEtim2mo ago
Hi @RedRoss Can you please provide more information about your request? Are you integrating it with Prisma?
RedRoss
RedRossOP2mo ago
I’m using hasura that handles the db in postges and hasura does not create a native type of postgres but creates a table with value and description and then is counterpointed as enum, so consequently prisma does not intercept it https://www.youtube.com/watch?v=PljuJGLLUeM
Code Daily
YouTube
Create GraphQL Enums with Hasura Enum Tables
We'll tackle setting up user types by creating a users_types table with a value text primary key. We'll add the users type as a foreign key to our new table. Finally we'll insert values as a SQL query and track it as a migration. Get the code repo at https://codedaily.io/tutorials/171/Create-GraphQL-Enums-with-Hasura-Enum-Tables
RaphaelEtim
RaphaelEtim2mo ago
Prisma doesn’t natively support Hasura's custom enum implementation. Would using $queryRawto directly interact with the database work for you?
RedRoss
RedRossOP2mo ago
Raw queries | Prisma Documentation
Learn how you can send raw SQL and MongoDB queries to your database using the raw() methods from the Prisma Client API.
RedRoss
RedRossOP2mo ago
@RaphaelEtim Reading the documentation does not seem to me that I can create types from the records of the table, or am I wrong?
Solution
RaphaelEtim
RaphaelEtim2mo ago
If i understand your question correctly, Prisma actually does generate TypeScript types based on your database schema, which you can use in your application. See this section of the documentation
RaphaelEtim
RaphaelEtim2mo ago
Models | Prisma Documentation
Learn about the concepts for building your data model with Prisma: Models, scalar types, enums, attributes, functions, IDs, default values and more.
Want results from more Discord servers?
Add your server