Int to Float or Double db:push

Hi we are working on a project that has drizzle db connected to a planetscale database. We initially had a column as an integer, but we later on decided that the column should be a float or a double. Doing a db:push truncates the column and deletes all the rows of the table. Is this a bug or is it like that by design? If it's by design what is the best way to update the columns to a double without wiping the table? Thanks in advance.
2 Replies
Andrii Sherman
Hi! did drizzle asks you about that it's going to truncate the table?
deciphyrx
deciphyrxOP2y ago
drizzle-kit: v0.18.1
drizzle-orm: v0.26.0

No config path provided, using default 'drizzle.config.ts'
Reading config file 'C:\Users\dg10m\Desktop\New folder\Bobbll\packages\db\drizzle.config.ts'
Reading schema files:
C:\Users\dg10m\Desktop\New folder\Bobbll\packages\db\schema.ts

· You're about to change salary_lower column type from alter_table_alter_column_set_type to float with 31 items
· You're about to change salary_upper column type from alter_table_alter_column_set_type to float with 31 items


THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED

Do you still want to push changes?
drizzle-kit: v0.18.1
drizzle-orm: v0.26.0

No config path provided, using default 'drizzle.config.ts'
Reading config file 'C:\Users\dg10m\Desktop\New folder\Bobbll\packages\db\drizzle.config.ts'
Reading schema files:
C:\Users\dg10m\Desktop\New folder\Bobbll\packages\db\schema.ts

· You're about to change salary_lower column type from alter_table_alter_column_set_type to float with 31 items
· You're about to change salary_upper column type from alter_table_alter_column_set_type to float with 31 items


THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED

Do you still want to push changes?
Yes it did, but I'm just wondering what's the best way to do it if not with db:push 🙂
Want results from more Discord servers?
Add your server