Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[drizzle-zod]: Create Existing View Schema #2874

Conversation

JoeRall
Copy link

@JoeRall JoeRall commented Aug 28, 2024

Created a new function that takes a view (existing) and returns a Zod Schema for the selected columns. This lets us have a single source of truth for the shape of our views in both our database and how that data goes over the wire.

To support this change, a new utility function was added to drizzle-orm that's used to get the selected columns of the existing view called getViewColumns.

@JoeRall JoeRall closed this Aug 28, 2024
@JoeRall JoeRall reopened this Aug 28, 2024
Utility function to get the selected columns for an existing view
Zod schema definition can now be created from a view definition where the view type is existing.
@JoeRall JoeRall force-pushed the drizzle-zod-create-existing-view-schema branch from bdc473f to 8b8e4f8 Compare August 29, 2024 00:17
@JoeRall
Copy link
Author

JoeRall commented Aug 29, 2024

I closed then reopened and force pushed to make sure all of my commits were verified. I apologize for the confusion.

@JoeRall
Copy link
Author

JoeRall commented Dec 9, 2024

It looks as though this has been implemented via #3398 -> #3508. So this is safe to close.

@JoeRall JoeRall closed this Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant