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
fe98ddcc
Commit
fe98ddcc
authored
Jan 13, 2022
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Swap FK ci_resource_groups to projects for LFK
Removes FK for ci_resource_groups to projects Changelog: changed
parent
b5fb1331
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
3 deletions
+26
-3
db/post_migrate/20220113014438_remove_projects_ci_resource_groups_project_id_fk.rb
...14438_remove_projects_ci_resource_groups_project_id_fk.rb
+15
-0
db/schema_migrations/20220113014438
db/schema_migrations/20220113014438
+1
-0
db/structure.sql
db/structure.sql
+0
-3
lib/gitlab/database/gitlab_loose_foreign_keys.yml
lib/gitlab/database/gitlab_loose_foreign_keys.yml
+5
-0
spec/models/ci/resource_group_spec.rb
spec/models/ci/resource_group_spec.rb
+5
-0
No files found.
db/post_migrate/20220113014438_remove_projects_ci_resource_groups_project_id_fk.rb
0 → 100644
View file @
fe98ddcc
# frozen_string_literal: true
class
RemoveProjectsCiResourceGroupsProjectIdFk
<
Gitlab
::
Database
::
Migration
[
1.0
]
disable_ddl_transaction!
def
up
with_lock_retries
do
remove_foreign_key_if_exists
(
:ci_resource_groups
,
:projects
,
name:
"fk_774722d144"
)
end
end
def
down
add_concurrent_foreign_key
(
:ci_resource_groups
,
:projects
,
name:
"fk_774722d144"
,
column: :project_id
,
target_column: :id
,
on_delete:
"cascade"
)
end
end
db/schema_migrations/20220113014438
0 → 100644
View file @
fe98ddcc
08d8a5a605058598a2f033bbd461518c502fb3da8627240c5d66f887b43f3ac3
\ No newline at end of file
db/structure.sql
View file @
fe98ddcc
...
...
@@ -29369,9 +29369,6 @@ ALTER TABLE ONLY vulnerabilities
ALTER TABLE ONLY oauth_openid_requests
ADD CONSTRAINT fk_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES oauth_access_grants(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_resource_groups
ADD CONSTRAINT fk_774722d144 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY users
ADD CONSTRAINT fk_789cd90b35 FOREIGN KEY (accepted_term_id) REFERENCES application_setting_terms(id) ON DELETE CASCADE;
lib/gitlab/database/gitlab_loose_foreign_keys.yml
View file @
fe98ddcc
---
dast_site_profiles_pipelines
:
-
table
:
ci_pipelines
column
:
ci_pipeline_id
...
...
@@ -38,6 +39,10 @@ ci_pending_builds:
-
table
:
namespaces
column
:
namespace_id
on_delete
:
async_delete
ci_resource_groups
:
-
table
:
projects
column
:
project_id
on_delete
:
async_delete
ci_runner_namespaces
:
-
table
:
namespaces
column
:
namespace_id
...
...
spec/models/ci/resource_group_spec.rb
View file @
fe98ddcc
...
...
@@ -3,6 +3,11 @@
require
'spec_helper'
RSpec
.
describe
Ci
::
ResourceGroup
do
it_behaves_like
'cleanup by a loose foreign key'
do
let!
(
:parent
)
{
create
(
:project
)
}
let!
(
:model
)
{
create
(
:ci_resource_group
,
project:
parent
)
}
end
describe
'validation'
do
it
'valids when key includes allowed character'
do
resource_group
=
build
(
:ci_resource_group
,
key:
'test'
)
...
...
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