Support for PostgreSQL check constraints #544
Closed
jpholtmeyer
started this conversation in
General
Replies: 1 comment 3 replies
-
Out of curiosity: is there any advantage to doing this over regular Postgres enums? A more generic version that works with arbitrary constraints would have to parse those and create the equivalent Zod code. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Would it be possible to support creating types that enforce PostgreSQL check constraints?
I'd like an opinion to see if it's worth investing effort into vs finding another solution.
As an example, lets say I define the column in a SQL table:
I would like the ability to generate a type with a property that looks something like this in Typescript:
type frequency = 'DAILY' | 'WEEKLY';
And also Zod types:
z.enum(['DAILY', 'WEEKLY'])
Any help is greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions