Add an index on the events.type column for faster SELECT DISTINCT() queries

This commit is contained in:
R. Tyler Croy 2018-10-21 09:15:05 -07:00
parent d6b048c417
commit 863322492b
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
'use strict';
const indexName ='events_type_index';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addIndex('events', {
name: indexName,
fields: ['type'],
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeIndex('events', indexName);
}
};