diff --git a/lib/database/migrations/v1/20260305110000-add-qcf-run-detector-index.js b/lib/database/migrations/v1/20260305110000-add-qcf-run-detector-index.js new file mode 100644 index 0000000000..4c04e5920e --- /dev/null +++ b/lib/database/migrations/v1/20260305110000-add-qcf-run-detector-index.js @@ -0,0 +1,28 @@ +/* + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. + */ + +'use strict'; + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + up: async (queryInterface) => queryInterface.sequelize.transaction(async (transaction) => { + await queryInterface.addIndex('quality_control_flags', { + name: 'quality_control_flags_run_detector_idx', + fields: ['run_number', 'detector_id'], + }, { transaction }); + }), + + down: async (queryInterface) => queryInterface.sequelize.transaction(async (transaction) => { + await queryInterface.removeIndex('quality_control_flags', 'quality_control_flags_run_detector_idx', { transaction }); + }), +};