drizzle-team / drizzle-team/drizzle-orm
[BUG]: `drizzle-kit` push on D1 database or sqlite does not respect `where` part of partial index
- 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?
0.44.2
### What version of `drizzle-kit` are you using?
0.31.3
### Other packages
_No response_
### Describe the Bug
#### What is the undesired behavior?
It is on CloudFlare D1 database. I have a database table that has already been pushed a table with an unique partial index. When I try to do `push` another time with exact table schema untouched, `drizzle-kit` would remind the following instead of telling me "No changes detected":
```
DROP INDEX `idx`;
CREATE UNIQUE INDEX `idx` ON `table` (`id`,`type`) WHERE "table"."isDeleted" is null;
```
#### What are the steps to reproduce it?
1. Using `push` command of `drizzle-kit`
2. Push a table with partial index(`where` clause after index)
3. Do `push` another time with schema untouched
4. You will see in the CLI telling you it would drop the index created in step.2 and create a same new one.
#### What is the desired result?
`drizzle-kit` should tell me "No changes detected". To be more specific, the internal schema introspection of `drizzle-kit` should recognize `Partial Index` and its conditional columns.
#### What database engine are you using? Are you using a specific cloud provider? Which one?
I am using `drizzle-kit` on D1 database of CloudFlare with following config:
``` javascript
export default defineConfig({
out: './migrations',
schema: './schema/index.ts',
dialect: 'sqlite',
driver: 'd1-http',
dbCredentials: {
// ...
},
})
```
Contributor guide
Assessment
This issue has not been assessed yet.