19 Replies
this is want it said when i tried to run drizzle-kit studio
Updated: i change my created_at and updated_at to
and it worked
then i drop title column, and it suddenly not working again
For timestamp you should be able to use:
I'm using postgres so I have an error:
Property onUpdateNow does not exist on type PgTimestampBuilder
How about
That's a long shot it may or may not work.
It did not worked, i'm struggling for hours for such a simple feature lmao
I'll suggest you edit it manually for now. Can you paste the result of the generate command? I'll help you edit it.
Sure, I appreciate it:
Right now I created a trigger:
And I'm calling after the users table creation with:
Can it get better?
Btw if this could be done in typescript as a function or something I think it will be better
is mysql and planetscale use the same syntax?
Would be great if you can create an issue on GH to support onUpdate functions
I'll gladly take thar into development
Andrew, I'm actually working on that for my next PR. It's very related to issues #596 and #921 that I'm working on
@quasar_here your migration should look like this:
@angelelz I appreciate your help very much and congratulations for becoming a Drizzle Advocate
I got a error when trying to run this migration and according to ChatGPT (I'm not proficient in databases myself), Postgres doesn't support update on current_timestamp that's why it recommended to use triggers instead
I though you were using mysql. You are importing from mysql in you original post. Your tables are
myqslTable
sActually I'm a guy who took the OP post to solve my issue because I didn't want to create another post
My bad. My answer is not going to work for you. I'm not super familiar with pg.
Feel free to open your own 😉 with all you have so I can look at your issue (PG user here).
never open github issue before, don't know what to write in the desc lol, but here you go
https://github.com/drizzle-team/drizzle-orm/issues/1106#issue-1864487095
GitHub
[FEATURE]: Support onUpdate Function (Mysql) · Issue #1106 · drizzl...
Describe what you want my current schema right now look like this: updated_at: timestamp('updated_at') .notNull() .default(sql
current_timestamp
) .onUpdateNow(), not sure if it the right w...