📜  sequelize 更新索引列 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:06.444000             🧑  作者: Mango

代码示例1
'use strict';

module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.addIndex('reports', ['client_id'])
      .then(() => {
        return queryInterface.addIndex('reports', ['report_name'])
      })
      .then(() => {
        return queryInterface.addIndex('reports', ['report_date'])
      })
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.removeIndex('reports', ['client_id'])
    .then(() => {
      return queryInterface.removeIndex('reports', ['report_name'])
    })
    .then(() => {
      return queryInterface.removeIndex('reports', ['report_date'])
    })
  }
};