Skip to content

'method' property is used for creating index with 'BTREE' type #17433

Description

@dazhuangc

Issue Creation Checklist

  • I understand that my issue will be automatically closed if I don't fill in the requested information
  • I have read the contribution guidelines

Bug Description

In packages/core/test/integration/model.test.js, test name 'should allow the user to specify indexes in options', method: 'BTREE' is used for creating an index. However, the BTREE is not reflected in the generated SQL.

I guess the reason is that packages/core/src/abstract-dialect/query-generator.js#addIndexQuery() is using using field as index type, not method field.

this.dialect.supports.index.using === 1 && options.using ? `USING ${options.using}` : '',

Reproducible Example

Here is the link to the SSCCE for this issue:

yarn lerna run test-integration-mysql

What do you expect to happen?

Test name 'should allow the user to specify indexes in options'.
Index type 'BTREE' should be used in the SQL statement.

ALTER TABLE `models` ADD UNIQUE INDEX `a_b_uniq` USING BTREE (`fieldB`, `fieldA`(5) ASC)

What is actually happening?

The SQL statement does not contain 'BTREE'.

ALTER TABLE `models` ADD UNIQUE INDEX `a_b_uniq` (`fieldB`, `fieldA`(5) ASC)

Environment

  • Sequelize version: latest main branch
  • Node.js version: 20.11.1
  • If TypeScript related: TypeScript version: N/A
  • Database & Version: MySQL latest docker image for integration test
  • Connector library & Version: mysql2 3.9.7

Would you be willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time and I know how to start.
  • Yes, I have the time but I will need guidance.
  • No, I don't have the time, but my company or I are supporting Sequelize through donations on OpenCollective.
  • No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in resolving my issue.

Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.

Activity

  1. added
    pending-approval
    type: bug
    on Aug 2, 2024
  2. lohart13 commented on Oct 7, 2024

    @lohart13
    Contributor

    PR #16227 should fix this this issue.

    The method option has been renamed to using.
    An error will be displayed if the user using the wrong option.

  3. removed
    pending-approval
    on Nov 16, 2024
  4. added theissue type on Mar 9, 2025
  5. removed
    type: bug
    on Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions