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

Column-level type mapping #567

Open
andreaperizzato opened this issue Feb 6, 2024 · 0 comments
Open

Column-level type mapping #567

andreaperizzato opened this issue Feb 6, 2024 · 0 comments

Comments

@andreaperizzato
Copy link

How can I map the type of a specific column to a custom type?

The doc explains how column postgres types can be mapped to specific JS types, but i was looking at setting up mappings at column level.

As an example, let's say I have a table users

id status
1 active
2 inactive

And a table orders

id status
1 dispatched
2 cancelled

And i would like to map users.status and orders.status to two custom TypeScript types. These may look like enums but the problem is more generic and could be any type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant