From 01211ca0766c4a93f7ec4c75a8dd7796e9b7cbe4 Mon Sep 17 00:00:00 2001 From: xsalonx <65893715+xsalonx@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:40:43 +0200 Subject: [PATCH] ch order of constraint creation (#1688) --- ...40718120539-add-type-column-to-detectors.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/database/migrations/20240718120539-add-type-column-to-detectors.js b/lib/database/migrations/20240718120539-add-type-column-to-detectors.js index c7b8423dc9..38df819e1b 100644 --- a/lib/database/migrations/20240718120539-add-type-column-to-detectors.js +++ b/lib/database/migrations/20240718120539-add-type-column-to-detectors.js @@ -21,23 +21,23 @@ module.exports = { up: async (queryInterface) => queryInterface.sequelize.transaction(async (transaction) => { await queryInterface.addConstraint('run_detectors', { type: 'FOREIGN KEY', - fields: ['detector_id'], - name: 'detector_id_fk_run_detectors', + fields: ['run_number'], + name: 'run_number_fk_run_detectors', references: { - table: 'detectors', - field: 'id', + table: 'runs', + field: 'run_number', }, - onUpdate: 'CASCADE', }, { transaction }); await queryInterface.addConstraint('run_detectors', { type: 'FOREIGN KEY', - fields: ['run_number'], - name: 'run_number_fk_run_detectors', + fields: ['detector_id'], + name: 'detector_id_fk_run_detectors', references: { - table: 'runs', - field: 'run_number', + table: 'detectors', + field: 'id', }, + onUpdate: 'CASCADE', }, { transaction }); await queryInterface.addColumn(