Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
672c854e
Commit
672c854e
authored
Mar 25, 2021
by
Arturo Herrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add foreign key from web_hooks to groups
This foreign key constraint prevents creating inconsistent records.
parent
6a96e3a5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
1 deletion
+28
-1
changelogs/unreleased/202423-foreign-key-webhooks-groups.yml
changelogs/unreleased/202423-foreign-key-webhooks-groups.yml
+5
-0
db/migrate/20210325092215_add_not_valid_foreign_key_to_group_hooks.rb
...0210325092215_add_not_valid_foreign_key_to_group_hooks.rb
+19
-0
db/schema_migrations/20210325092215
db/schema_migrations/20210325092215
+1
-0
db/structure.sql
db/structure.sql
+3
-0
spec/db/schema_spec.rb
spec/db/schema_spec.rb
+0
-1
No files found.
changelogs/unreleased/202423-foreign-key-webhooks-groups.yml
0 → 100644
View file @
672c854e
---
title
:
Add foreign key from web_hooks to groups
merge_request
:
57735
author
:
type
:
other
db/migrate/20210325092215_add_not_valid_foreign_key_to_group_hooks.rb
0 → 100644
View file @
672c854e
# 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
db/schema_migrations/20210325092215
0 → 100644
View file @
672c854e
ea819fd401c5566986fd495ed3b8aa0d296d6c9e3fedf2a10f34cb7fbaeedb20
\ No newline at end of file
db/structure.sql
View file @
672c854e
...
...
@@ -26571,6 +26571,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;
spec/db/schema_spec.rb
View file @
672c854e
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment