blob: 235959bfa0cce552a8480f3f7c6b5c1ccf494db9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
class FixApplicationSettingPushRuleIdFk < Gitlab::Database::Migration[2.1]
restrict_gitlab_migration gitlab_schema: :gitlab_main
# This migration fixes missing `track_record_deletions(:push_rules)`
# where the `application_settings.push_rule_id` would not be reset
# after removing push rule.
def up
execute <<~SQL
UPDATE application_settings SET push_rule_id=NULL
WHERE push_rule_id IS NOT NULL AND NOT EXISTS (
SELECT * FROM push_rules WHERE push_rules.id = application_settings.push_rule_id
)
SQL
end
def down; end
end
|