You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if there is some kind of type direclty available for the entire DB schema by default? I couldn't directly find anything in the docs.
We currently access types like this:
DB.Tables.Organization.Select.Type
Or keys directly
DB.Tables.Organization.Select.Type["id"]
We currently have a namespace called DB which contains all the Schema tables and each table contains a type as well as a zodschema for easy access, however we do have to update this each time a table is added or potentially removed from the schema, and I thought that this might be generated in some way during the generation process?
exportnamespaceDB{/** DB Tables */exportnamespaceTables{/** User */exportnamespaceUser{// Each table contains an insert and select namespace that each have a type and a zod schemaexportnamespaceSelect{exporttypeType=typeofusers.$inferSelect;exportconstZodSchema=createSelectSchema(users);}exportnamespaceInsert{exporttypeType=typeofusers.$inferInsert;exportconstZodSchema=createInsertSchema(users);}}exportnamespaceOrganization{// ....}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I was wondering if there is some kind of type direclty available for the entire DB schema by default? I couldn't directly find anything in the docs.
We currently access types like this:
Or keys directly
We currently have a namespace called
DB
which contains all the Schema tables and each table contains a type as well as a zodschema for easy access, however we do have to update this each time a table is added or potentially removed from the schema, and I thought that this might be generated in some way during the generation process?Beta Was this translation helpful? Give feedback.
All reactions