Skip to content

[BUG]: drizzle-kit push on D1 database or sqlite does not respect where part of partial index #4688

Open
@ColaFanta

Description

@ColaFanta

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.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:

export default defineConfig({
  out: './migrations',
  schema: './schema/index.ts',
  dialect: 'sqlite',
  driver: 'd1-http',
  dbCredentials: {
    // ...
  },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions