drizzle-team / drizzle-team/drizzle-orm
[BUG]: Changing a view to materialized view doesn't generate correct migration
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
drizzle-kit@1.0.0-rc.4
### What version of `drizzle-kit` are you using?
drizzle-kit@1.0.0-rc.4 and drizzle-kit@1.0.0-rc.5-ab785fc
### Other packages
_No response_
### Describe the Bug
Changing a `pgView` to `pgMaterializedView` does not drop and create the view again.
I have created a small repro setup here.
https://github.com/adiSuper94/drizzle-materialized-view-bug/commit/bdd544f41155cfbd462031e4742deec04abfc3dd
I tried using drizzle-kit@1.0.0-rc.4 and drizzle-kit@1.0.0-rc.5-ab785fc. Faced issue in both versions.
https://github.com/drizzle-team/drizzle-orm/issues/3179 - looks related but this is not on v1.rc.
https://github.com/drizzle-team/drizzle-orm/issues/3856 and https://github.com/drizzle-team/drizzle-orm/issues/4520 are issues about materialized views that have the tag "fixed-in-beta", but I was able to repro it in aug10 drizzle-kit@1.0.0-rc.5-ab785fc.
Contributor guide
Research direction
Start with the linked minimal reproduction and inspect how drizzle-kit compares pgView with pgMaterializedView when generating migrations. Reproduce the reported change, trace the migration-generation entry point, and verify that the resulting migration drops the existing view and creates the materialized view.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, typescript
- Domain
- databases, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100