Changing postgres timestamp mode (string -> date) isn't reflected in migrations
Hi.
I have my migrations generated and applied from my initial schema.
Now in the schema I changed to
mode: 'date'
in multiple timestamp columns (ex: time: timestamp({ withTimezone: true, mode: 'date' }).notNull(),
). This was mode: 'string'
by default previously.
Now when I run the drizzle-kit generate
command, no migrations are generated. I made this change to multiple columns.
Is this a bug or is it expected behaviour?3 Replies
One more thing I noticed is:
I reset the local db (
supabase db reset
), generated/applied the migrations again (with mode: 'date'
).
Now elsewhere when I pull schema (drizzle-kit pull
), they still have mode: 'string'
. Very confused now!Date is stored as string in postgres/mysql. The mode: ‘date’ only affects the typescript type. Behind the scene, your data is always saved as string.
Okay that makes sense. That's why no migrations are generated. Drizzle then probably has no way to know from schema pull. Pefect. Thanks a lot for the help.
Although being shown the wrong value after pull is confusing. They should just omit the field.
Sorry for delay in reply, didn't get your notification.