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

Prisma PostgreSQL native types mapping support #6

Open
pasha-vuiko opened this issue Aug 22, 2024 · 9 comments
Open

Prisma PostgreSQL native types mapping support #6

pasha-vuiko opened this issue Aug 22, 2024 · 9 comments
Assignees

Comments

@pasha-vuiko
Copy link

Hi!
I would like to request support for Postgres Native types mapping from the Prisma Schema, for example Prisma Schema:

model EveryDayScheduleItem {
    scheduledTime DateTime @db.Time()
}

Now generated to this drizzle schema:

export const EveryDayScheduleItem = pgTable('EveryDayScheduleItem',
{
    scheduledTime: timestamp('scheduledTime', { precision: 3}).notNull()
}

But it should be:

export const EveryDayScheduleItem = pgTable('EveryDayScheduleItem',
{
    scheduledTime: time('scheduledTime', { precision: 3}).notNull()
}
@Sukairo-02
Copy link
Collaborator

I'd like to, but Prisma does not expose this data, as well as onUpdate in it's generator API.

@Sukairo-02 Sukairo-02 self-assigned this Aug 23, 2024
@pasha-vuiko
Copy link
Author

Sounds not good =((
Maybe it would be a nice idea to create an issue in the Prisma repository that would mention the problem?

@Sukairo-02
Copy link
Collaborator

We actually reached out to them already on Discord and I believe I've seen the issue requesting this from long ago, not sure what else I can do to make it happen.

@pasha-vuiko
Copy link
Author

I got it, so I guess the issue can be closed

@Sukairo-02
Copy link
Collaborator

Let it be, this IS an issue after all, just not all that dependent on my actions for now

@pasha-vuiko
Copy link
Author

I understand

@pasha-vuiko
Copy link
Author

Hey! What do you think about this? 🙂
prisma/prisma#10252 (comment)

This might help to implement the lacking functionality

@pasha-vuiko
Copy link
Author

pasha-vuiko commented Sep 4, 2024

I've created the PR using the approach above to add support for Time type for PostgreSQL
#7

By this example possible to add support for other types. It can be temporary solution till the moment when Prisma team implements the native type exposing natively

@pasha-vuiko
Copy link
Author

I've also added support of native time type for MySQL

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

No branches or pull requests

2 participants