0
votes

I'm using the Sequelize-CLI migrations for my project. I want to create a migration that adds the CLUSTERED index on two of my columns (id and date). I want to set the date sorting to DESC

Here's the QUERY that I basically want to perform:

CREATE CLUSTERED INDEX IX_id_date ON [dbName].[dbo].[table] ([id], [date] DESC)

Right now my code looks like this:

return queryInterface.addIndex(tableName, ['id', 'date'],
        {
          name: 'IX_id_date',
          type: 'CLUSTERED'
        })

but I have no idea how I can add the DESC option on date column index. Didn't find the solution in the sequelize docs, and anywhere on stackoverflow.

Thanks for the help.

1

1 Answers

0
votes

enter image description here

The ColumnName3 is also a column in a table. You can use the order as ASC or DESC as per your requirement.