diff options
Diffstat (limited to 'db/migrate/20200325104834_add_push_rules_foreign_key_to_application_settings.rb')
-rw-r--r-- | db/migrate/20200325104834_add_push_rules_foreign_key_to_application_settings.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20200325104834_add_push_rules_foreign_key_to_application_settings.rb b/db/migrate/20200325104834_add_push_rules_foreign_key_to_application_settings.rb new file mode 100644 index 00000000000..5263250833d --- /dev/null +++ b/db/migrate/20200325104834_add_push_rules_foreign_key_to_application_settings.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddPushRulesForeignKeyToApplicationSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + disable_ddl_transaction! + + def up + add_concurrent_index :application_settings, :push_rule_id, unique: true + add_concurrent_foreign_key :application_settings, :push_rules, column: :push_rule_id, on_delete: :nullify + end + + def down + remove_concurrent_index :application_settings, :push_rule_id + remove_foreign_key_if_exists :application_settings, column: :push_rule_id + end +end |