From 684052de5c10dd5bb761b09fc48f6c04a13dd908 Mon Sep 17 00:00:00 2001 From: KishenKumarrrrr Date: Mon, 12 Aug 2024 11:30:54 +0800 Subject: [PATCH 1/2] feat: add user_id indx to email_messages_transactional --- ...ser-id-index-to-email-messages-transactional.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 backend/src/database/migrations/20240812063204-add-user-id-index-to-email-messages-transactional.js diff --git a/backend/src/database/migrations/20240812063204-add-user-id-index-to-email-messages-transactional.js b/backend/src/database/migrations/20240812063204-add-user-id-index-to-email-messages-transactional.js new file mode 100644 index 000000000..95faeb7ab --- /dev/null +++ b/backend/src/database/migrations/20240812063204-add-user-id-index-to-email-messages-transactional.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + up: async (queryInterface, Sequelize) => { + await queryInterface.addIndex('email_messages_transactional', { + name: 'email_messages_transactional_user_id_idx', + fields: ['user_id'] + }) + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.removeIndex('email_messages_transactional', 'email_messages_transactional_user_id_idx') + } +}; From ed2a37b338113469dd162a476719a9b1386a097c Mon Sep 17 00:00:00 2001 From: KishenKumarrrrr Date: Mon, 12 Aug 2024 13:15:58 +0800 Subject: [PATCH 2/2] refactor: make indx composite of user_id and tag --- ...204-add-user-id-index-to-email-messages-transactional.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/database/migrations/20240812063204-add-user-id-index-to-email-messages-transactional.js b/backend/src/database/migrations/20240812063204-add-user-id-index-to-email-messages-transactional.js index 95faeb7ab..64e8910d5 100644 --- a/backend/src/database/migrations/20240812063204-add-user-id-index-to-email-messages-transactional.js +++ b/backend/src/database/migrations/20240812063204-add-user-id-index-to-email-messages-transactional.js @@ -3,12 +3,12 @@ module.exports = { up: async (queryInterface, Sequelize) => { await queryInterface.addIndex('email_messages_transactional', { - name: 'email_messages_transactional_user_id_idx', - fields: ['user_id'] + name: 'email_messages_transactional_user_id_tag_idx', + fields: ['user_id', 'tag'] }) }, down: async (queryInterface, Sequelize) => { - await queryInterface.removeIndex('email_messages_transactional', 'email_messages_transactional_user_id_idx') + await queryInterface.removeIndex('email_messages_transactional', 'email_messages_transactional_user_id_tag_idx') } };