Invalid default value for timestamp
Hi, I have recently started learning SQL and I've run into this problem with Drizzle Kit. I have this promoCodes table:
and when I try to push it using
pnpm drizzle-kit push:mysql
, I get this error:
9 Replies
@Andrii Sherman
If you are using PlanetScale try to change .defaultNow() to
PlanetScale is restricting (now()) expressions
Just inquiring further about this, any fix yet? I did as suggested and changed
.defaultNow()
to
but i'm still receiving the same error
Ps I am also using planetscaleCould you try running the alter column query manually on planetscale to check if it works at all?
looks to be the same error on their end ill check the docs
Hey is this error still showing up or have you found a workaround?
For now I just removed the created at and updated at, lol
If I figure it out I’ll post in here 😁
I had to change it to
and for updateNow()
but that updateNow is probably really not recommended
For some reason planetsale requires
CURRENT_TIMESTAMP
to be called as a function and not just an interpreted valueWeird
We'll probably need to allow customizing the
onUpdate
value, in addition to onUpdateNow