Invalid default value when using defaultNow()

CCory5/1/2023
Receiving error:
Invalid default value for 'updated_at' (errno 1067) (sqlstate 42000) (CallerID: 2ga5bxx7mhtso265npy7): Sql: "alter table menus add UNIQUE INDEX menus_public_id_idx (public_id)", BindVars: {REDACTED}`
CCory5/1/2023
Seems to happen where there is uniqueindex on table
ASAndrii Sherman5/1/2023
is it PlanetScale?
CCory5/1/2023
Yes
CCory5/3/2023
Any updates on this?
ASAndrii Sherman5/4/2023
Yeah, sorry
Could you please explain steps to reproduce?
Does this error happen in insert/select?
Or do you see it while running migrations?
CCory5/4/2023
It happens on drizzle-push. If I have defaultNow() on one of the columns, it starts to complain when I am trying to add indexes or push another update
CCory5/4/2023
Not sure if this is somethikng on Planetscales side?
CCory5/4/2023
Intersseing someone having similar issue here without Drizzle
CCory5/4/2023
This seems to solve it
CCory5/4/2023
So it seems like it was some sort of PlanetScale issue
ASAndrii Sherman5/5/2023
Yeah, so the case is that PlanetScale have some issues with using default (now())

I would suggest using
default(sql`CURRENT_TIMESTAMP`)

For “default now” with PlanetScale
ASAndrii Sherman5/5/2023
Try to regenerate table with this default and then it should work properly
ASAndrii Sherman5/5/2023
We will add .defaultCurrentTimestamp() for PlanetScale cases