Commit b3567208 authored by Tiger Watson's avatar Tiger Watson

Merge branch '202423-foreign-key-webhooks-groups' into 'master'

Add foreign key from web_hooks to groups

See merge request gitlab-org/gitlab!57735
parents c25235b2 672c854e
---
title: Add foreign key from web_hooks to groups
merge_request: 57735
author:
type: other
# frozen_string_literal: true
class AddNotValidForeignKeyToGroupHooks < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
with_lock_retries do
add_foreign_key :web_hooks, :namespaces, column: :group_id, on_delete: :cascade, validate: false
end
end
def down
with_lock_retries do
remove_foreign_key_if_exists :web_hooks, column: :group_id
end
end
end
ea819fd401c5566986fd495ed3b8aa0d296d6c9e3fedf2a10f34cb7fbaeedb20
\ No newline at end of file
......@@ -26639,6 +26639,9 @@ ALTER TABLE ONLY requirements_management_test_reports
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;
ALTER TABLE ONLY group_group_links
ADD CONSTRAINT fk_rails_d3a0488427 FOREIGN KEY (shared_group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
......@@ -87,7 +87,6 @@ RSpec.describe 'Database schema' do
users_star_projects: %w[user_id],
vulnerability_identifiers: %w[external_id],
vulnerability_scanners: %w[external_id],
web_hooks: %w[group_id],
web_hook_logs_part_0c5294f417: %w[web_hook_id]
}.with_indifferent_access.freeze
......
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