Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]:drizzle-kit generate: migration.sql is missing renamed column's changes #3826

Open
1 task done
rupin-rk opened this issue Dec 23, 2024 · 3 comments
Open
1 task done
Labels
bug Something isn't working drizzle/kit priority Will be worked on next

Comments

@rupin-rk
Copy link

rupin-rk commented Dec 23, 2024

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.38.2

What version of drizzle-kit are you using?

0.30.1

Other packages

No response

Describe the Bug

What is the undesired behavior?

In schema file, when a column's name is changed and it's config is also changed like data type, not null constraint etc.; running drizzle-kit generate and selecting renamed column option only includes rename column sql command in generated migration file. sql commands for data type changes and adding/removing constraints are not included. generated snapshot correctly reflects new schema though. I am using 'postgresql' dialect.

What are the steps to reproduce it?

  • in schema file; change column name and change something in it's value like data type or add/remove not null constraint.
  • Run drizzle-kit generate; select renamed column option.
  • check generated sql migration file; it only includes rename column command and not other changes for the column.

What is the desired result?

migration file should include sql commands for column data type and constraint changes along with rename command.

@rupin-rk rupin-rk added the bug Something isn't working label Dec 23, 2024
@L-Mario564 L-Mario564 added drizzle/kit priority Will be worked on next labels Dec 23, 2024
@L-Mario564
Copy link
Collaborator

What dialect are you using?

@rupin-rk
Copy link
Author

What dialect are you using?

postgresql

@rupin-rk
Copy link
Author

Also, running drizzle-kit check after this says everything's fine. Shouldn't it detect that migration file is not correctly representing diff between two snapshot.json ?

drizzle-kit migrate says migrations applied successfully.

I think there should be some way to verify the correctness of migration file in cases when generated migration file is not fully correct or when we manually modify it after drizzle-kit generate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working drizzle/kit priority Will be worked on next
Projects
None yet
Development

No branches or pull requests

2 participants