Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sequelize.js addIndex not using indexName

I am trying to create an index using sequelize.js addIndex function, the index is created but not with the name specified in the indexName option.

I am using the code below

  queryInterface.addIndex('Item',
  ['name', 'description'], {
    indicesType: 'FULLTEXT',
    indexName: 'idx_item_fulltext'
  })

After running migration, the index is created with the name 'item_name_description' and not 'idx_item_fulltext' which is the name I specified.

like image 748
Olu Udeh Avatar asked May 28 '19 01:05

Olu Udeh


1 Answers

For sequelize-cli and sequelize version 5+ there are no indicesType and indexName properties in addIndex options:

Please try:

queryInterface.addIndex('Item', ['name', 'description'], {
    type: 'FULLTEXT',
    name: 'idx_item_fulltext'
})
like image 77
Ihor Sakailiuk Avatar answered Nov 15 '22 11:11

Ihor Sakailiuk