Planetscale db:push has issues with default values
Just tried to update my database, was prototyping it for some time, and thought I should sync it again (actually to add a property). Now I can see that there are a lot of default sets (unnecessary, as they are like so in the db), and especially the ones for "timestamp" are not working. Repeatidly getting error for an invalid default value:
Even if I manually modify the database hoping drizzle-kit would then forget these updates, it doesn't work. Running all on drizzle's latest versions.
3 Replies
If you are using .defaultNow() it will be removed soon. Use this instead:
default(sql
CURRENT_TIMESTAMP
)
(Make sure you import the sql operator)This was very helpful, thank you very much! Now it passes at least. But still gives me these update statements on every run again:
Is it caching the metadata or is drizzle just wrongly detecting the urge to change the schema?
That’s interesting! Since you are using planetscale, maybe try to comment out your schema completely in your schema drizzle file, then db push to your dev branch (providing you don’t store any data on there, which is my understanding that you shouldn’t be) and then uncomment your schema, and db push again