diff options
Diffstat (limited to 'db/migrate/20230330101443_remove_old_fk_ml_candidate_metrics_on_candidate_id.rb')
-rw-r--r-- | db/migrate/20230330101443_remove_old_fk_ml_candidate_metrics_on_candidate_id.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20230330101443_remove_old_fk_ml_candidate_metrics_on_candidate_id.rb b/db/migrate/20230330101443_remove_old_fk_ml_candidate_metrics_on_candidate_id.rb new file mode 100644 index 00000000000..2e9153cb9d9 --- /dev/null +++ b/db/migrate/20230330101443_remove_old_fk_ml_candidate_metrics_on_candidate_id.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RemoveOldFkMlCandidateMetricsOnCandidateId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + OLD_CONSTRAINT_NAME = 'fk_rails_efb613a25a' + + def up + remove_foreign_key_if_exists(:ml_candidate_metrics, column: :candidate_id, name: OLD_CONSTRAINT_NAME) + end + + def down + add_concurrent_foreign_key( + :ml_candidate_metrics, + :ml_candidates, + column: :candidate_id, + validate: false, + name: OLD_CONSTRAINT_NAME + ) + end +end |