question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating an index (`queryInterface.addIndex`) with both `fn` and ORDER

See original GitHub issue

What was unclear/insufficient/not covered in the documentation

How we can add DESC index when we use fn ?

this.queryInterface.addIndex('Group', [this.sequelize.fn('lower', this.sequelize.col('username'))], {
     name: 'group_username_lower'
})

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sm2017commented, Jul 13, 2019

How to use in addIndex?

1reaction
sm2017commented, Oct 29, 2019

I want to create

CREATE INDEX ON my_table (LOWER(username) DESC)

Currently sequelize can generate :

CREATE INDEX ON my_table (username DESC)
CREATE INDEX ON my_table (LOWER(username))
Read more comments on GitHub >

github_iconTop Results From Across the Web

Sequelize Migration addIndex not adding index in descending ...
The proper way to define index in descending order is extended definition in fields argument. So the migration file add-index.js should look ...
Read more >
How to use addIndex function in QueryInterface - Tabnine
Sequelize.sync. Sync all defined models to the DB. · Model.name. The singular name of the model · Model.create. Builds a new model instance...
Read more >
Create a table and add indexes in a single migration with ...
I created a whole new migration file using raw syntax module.exports = { up: (queryInterface) => { return queryInterface.sequelize.query('CREATE INDEX ...
Read more >
Sequelize It - GitHub Pages
sequelize model:create --name Todo --attributes title:string,desc:text ... defaultValue: '' }), await queryInterface.sequelize.query( 'UPDATE Order SET ...
Read more >
lib/model.js | Sequelize
indexes [].using] The method to create the index by (`USING` statement in SQL). BTREE and HASH are supported by mysql and postgres, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found