Commit ad76d603 authored by Toon Claes's avatar Toon Claes

Merge branch '202423-validate-foreign-key-on-group-hooks' into 'master'

Validate foreign key on GroupHooks

See merge request gitlab-org/gitlab!60266
parents 031d643b bd2f3671
---
title: Validate foreign key on GroupHooks
merge_request: 60266
author:
type: other
# frozen_string_literal: true
class ValidateForeignKeyOnGroupHooks < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
CONSTRAINT_NAME = 'fk_rails_d35697648e'
def up
validate_foreign_key :web_hooks, :group_id, name: CONSTRAINT_NAME
end
def down
# no-op
end
end
e7020e969ea589d4de50bdae7c8c43f52acb1c886d4f9203ff45f631e057d7bc
\ No newline at end of file
......@@ -26727,7 +26727,7 @@ ALTER TABLE ONLY pool_repositories
ADD CONSTRAINT fk_rails_d2711daad4 FOREIGN KEY (source_project_id) REFERENCES projects(id) ON DELETE SET NULL;
ALTER TABLE ONLY web_hooks
ADD CONSTRAINT fk_rails_d35697648e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE NOT VALID;
ADD CONSTRAINT fk_rails_d35697648e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY group_group_links
ADD CONSTRAINT fk_rails_d3a0488427 FOREIGN KEY (shared_group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
......@@ -30,7 +30,7 @@ module EE
has_many :ldap_group_links, foreign_key: 'group_id', dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :saml_group_links, foreign_key: 'group_id'
has_many :hooks, dependent: :destroy, class_name: 'GroupHook' # rubocop:disable Cop/ActiveRecordDependent
has_many :hooks, class_name: 'GroupHook'
has_many :allowed_email_domains, -> { order(id: :asc) }, autosave: true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment