Commit e1a1b53b authored by Arturo Herrero's avatar Arturo Herrero

Validate foreign key on ServiceHooks

In 13.7 we prevented invalid records
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47821 and fixed
existing records
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48263.

We can now validate the foreign key.
parent 549ea1d9
---
title: Validate foreign key on ServiceHooks
merge_request: 57483
author:
type: other
# frozen_string_literal: true
class ValidateForeignKeyOnServiceHooks < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
CONSTRAINT_NAME = 'fk_d47999a98a'
def up
validate_foreign_key :web_hooks, :service_id, name: CONSTRAINT_NAME
end
def down
# no-op
end
end
27fcdd54a21d554e44df621e409b81fe248e00851c856d315f4f64b463c7a5b7
\ No newline at end of file
......@@ -25133,7 +25133,7 @@ ALTER TABLE ONLY ci_builds
ADD CONSTRAINT fk_d3130c9a7f FOREIGN KEY (commit_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
ALTER TABLE ONLY web_hooks
ADD CONSTRAINT fk_d47999a98a FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE NOT VALID;
ADD CONSTRAINT fk_d47999a98a FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_sources_pipelines
ADD CONSTRAINT fk_d4e29af7d7 FOREIGN KEY (source_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
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