Repository navigation
MySQL migration invalid default value @default(now()) #24547
Replies: 3 comments 2 replies
|
Hi @tryoasnafi 👋 Thank you for raising this question. I can confirm that using the model buggy {
id Int @id @default(autoincrement())
created_at DateTime @default(now()) @db.Timestamp()
}However, if you do pass a a value for the fractional seconds part, then the migration does indeed work. For example: model buggy {
id Int @id @default(autoincrement())
created_at DateTime @default(now()) @db.Timestamp(0)
} |
|
Hi there, To keep our discussions organized and focused on the most relevant topics, we’re reviewing and tidying up our backlog. As part of this process, we’re closing discussions that haven’t had any recent activity and appear to be outdated. If this discussion is still important to you or unresolved, we’d love to hear from you! Feel free to reopen it or start a new one with updated details. For more details about our priorities and vision for the future of Prisma ORM, check out our latest blog post: https://www.prisma.io/blog/prisma-orm-manifesto. Thank you for your understanding and being part of the community!; |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Bug description
Error when migrate database MySQL:
When i use
@default(now())it's error, but when i change to@default(dbgenerated("NOW()"))it's success.I look into the generated file, it generated
CURRENT_TIMESTAMP(3)instead ofCURRENT_TIMESTAMP.Logs:
How to reproduce
Run
DEBUG="*" ./node_modules/.bin/prisma migrate devExpected behavior
Migration sql generated correctly and run successfully
Prisma information
Generated SQL:
Look correct format mysql: https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html
Environment & setup
Dockerfile
compose.yaml
.env
Prisma Version
All reactions