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 migration doesn't account for any newly added index #3857

Closed
1 task done
shirshendubhowmick opened this issue Dec 28, 2024 · 1 comment
Closed
1 task done
Labels
bug Something isn't working

Comments

@shirshendubhowmick
Copy link

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

What version of drizzle-kit are you using?

0.30.1

Other packages

No response

Describe the Bug

If we try to add a new index to an existing column, drizzle-kit generate doesn't account for it.

For example
An existing table like this:

export const myTable = pgTable(
  "my_table",
  {
    id: uuid("id").primaryKey().defaultRandom(),
    slug: text("slug").notNull(),
    filenames: text("filenames").array().notNull(),
    commonName: text("common_name").notNull(),
  },
  (table) => [
    {
      commonNameIdx: index("common_name_idx").on(table.commonName),
    },
  ]
);

Now if I try t add one more index on an existing column

export const myTable = pgTable(
  "my_table",
  {
    id: uuid("id").primaryKey().defaultRandom(),
    slug: text("slug").notNull(),
    filenames: text("filenames").array().notNull(),
    commonName: text("common_name").notNull(),
  },
  (table) => [
    {
      commonNameIdx: index("common_name_idx").on(table.commonName),
      slugIdx: index("slug_idx").on(table.slug),
    },
  ]
);

drizzle-kit generate says No schema changes, nothing to migrate

@shirshendubhowmick shirshendubhowmick added the bug Something isn't working label Dec 28, 2024
@shirshendubhowmick
Copy link
Author

Closing this as the there some issue with the syntax, if it returns object instead of array ob objects it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant