diff --git a/server/migrations/20200926204620-add-missing-indexes.js b/server/migrations/20200926204620-add-missing-indexes.js new file mode 100644 index 00000000..3e730d26 --- /dev/null +++ b/server/migrations/20200926204620-add-missing-indexes.js @@ -0,0 +1,19 @@ +'use strict'; + +module.exports = { + up: async (queryInterface, Sequelize) => { + await queryInterface.addIndex("search_queries", ["teamId"]); + await queryInterface.addIndex("search_queries", ["userId"]); + await queryInterface.addIndex("search_queries", ["createdAt"]); + + await queryInterface.addIndex("users", ["teamId"]); + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.removeIndex("search_queries", ["teamId"]); + await queryInterface.removeIndex("search_queries", ["userId"]); + await queryInterface.removeIndex("search_queries", ["createdAt"]); + + await queryInterface.removeIndex("users", ["teamId"]); + } +};