web/migrations/21000101000049-article-add-topic-api-order-index.js
const name = 'article_topic_id_created_at_id'
const { addIndexIfMissing, removeIndexIfExists } = require('../migration_helpers')
module.exports = {
// PostgreSQL concurrent index creation must run outside a transaction.
up: async queryInterface => addIndexIfMissing(queryInterface, 'Article', [
{ name: 'topicId', order: 'DESC' },
{ name: 'createdAt', order: queryInterface.sequelize.options.dialect === 'postgres' ? 'DESC NULLS LAST' : 'DESC' },
{ name: 'id', order: 'DESC' },
], { name, concurrently: true }),
down: async queryInterface => removeIndexIfExists(queryInterface, 'Article', name, { concurrently: true }),
}