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 schema: Remove empty dbgenerated() attribute #19313

Open
2 of 9 tasks
Jolg42 opened this issue May 17, 2023 · 4 comments
Open
2 of 9 tasks

Prisma schema: Remove empty dbgenerated() attribute #19313

Jolg42 opened this issue May 17, 2023 · 4 comments
Labels

Comments

@Jolg42
Copy link
Member

Jolg42 commented May 17, 2023

Example

 createdAt DateTime @default(dbgenerated())

In the times of old, an empty dbgenerated() in a @default field attribute was used by the introspection in fields, where we could not parse the default value correctly. Later on in the migration engine, we started to use it to pass custom SQL, and an empty value is in general just skipped.

In the real world, an empty dbgenerated() can cause drift and weird panics. We allow it in the PSL for backwards-compatibility. We should make it a validation error. The user can just db pull the database and get a non-empty value to the field’s default attribute.

@Jolg42 Jolg42 added this to the 5.0.0 milestone May 17, 2023
@Jolg42 Jolg42 added topic: prisma5 tech/engines Issue for tech Engines. labels May 17, 2023
@janpio
Copy link
Member

janpio commented May 22, 2023

https://github.com/search?q=repo%3Aprisma%2Fintrospection-ci%20dbgenerated()&type=code

@Jolg42
Copy link
Member Author

Jolg42 commented May 24, 2023

Note:
Just found these 2 small private issues:
https://github.com/prisma/schema-team/issues/215
https://github.com/prisma/team-orm/issues/162

@janpio
Copy link
Member

janpio commented Jul 5, 2023

Docs PR prepared for when this got implemented: prisma/docs#5007

@janpio
Copy link
Member

janpio commented Jul 5, 2023

Survey to collect feedback on why users might still be using it: #20077

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

No branches or pull requests

2 participants