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

fix(drizzle): enforce uniqueness on index names #8754

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

r1tsuu
Copy link
Member

@r1tsuu r1tsuu commented Oct 16, 2024

Fixes #8752

Previously, trying to define a config like this:

{
  type: 'text',
  name: 'someText',
  index: true,
},
{
  type: 'array',
  name: 'some',
  index: true,
  fields: [
    {
      type: 'text',
      name: 'text',
      index: true,
    },
  ],
}

Lead to the error:

Warning  We've found duplicated index name across public schema. Please rename your index in either the demonstration table or the table with the duplicated index name

Now, if we encounter duplicates, we increment the name like this:
collection_some_text_idx
collection_some_text_1_idx

Copy link
Contributor

@DanRibbens DanRibbens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I just have one small adjustment.

@DanRibbens DanRibbens enabled auto-merge (squash) October 17, 2024 01:49
@DanRibbens DanRibbens merged commit 90bca15 into beta Oct 17, 2024
51 checks passed
@DanRibbens DanRibbens deleted the fix/build-unique-index-names branch October 17, 2024 02:05
Copy link
Contributor

🚀 This is included in version v3.0.0-beta.116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate index error with similar field names
2 participants