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
77bdbbf9
Commit
77bdbbf9
authored
Dec 06, 2021
by
David Fernandez
Committed by
Dylan Griffith
Dec 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add loose FK between package tables and ci pipelines
parent
a70428b3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
7 deletions
+8
-7
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+0
-2
lib/gitlab/database/gitlab_loose_foreign_keys.yml
lib/gitlab/database/gitlab_loose_foreign_keys.yml
+8
-0
spec/db/schema_spec.rb
spec/db/schema_spec.rb
+0
-2
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+0
-2
spec/support/database/cross-database-modification-allowlist.yml
...upport/database/cross-database-modification-allowlist.yml
+0
-1
No files found.
app/models/ci/pipeline.rb
View file @
77bdbbf9
...
...
@@ -82,8 +82,6 @@ module Ci
# Merge requests for which the current pipeline is running against
# the merge request's latest commit.
has_many
:merge_requests_as_head_pipeline
,
foreign_key:
"head_pipeline_id"
,
class_name:
'MergeRequest'
has_many
:package_build_infos
,
class_name:
'Packages::BuildInfo'
,
dependent: :nullify
,
inverse_of: :pipeline
# rubocop:disable Cop/ActiveRecordDependent
has_many
:package_file_build_infos
,
class_name:
'Packages::PackageFileBuildInfo'
,
dependent: :nullify
,
inverse_of: :pipeline
# rubocop:disable Cop/ActiveRecordDependent
has_many
:pending_builds
,
->
{
pending
},
foreign_key: :commit_id
,
class_name:
'Ci::Build'
,
inverse_of: :pipeline
has_many
:failed_builds
,
->
{
latest
.
failed
},
foreign_key: :commit_id
,
class_name:
'Ci::Build'
,
inverse_of: :pipeline
has_many
:retryable_builds
,
->
{
latest
.
failed_or_canceled
.
includes
(
:project
)
},
foreign_key: :commit_id
,
class_name:
'Ci::Build'
,
inverse_of: :pipeline
...
...
lib/gitlab/database/gitlab_loose_foreign_keys.yml
View file @
77bdbbf9
...
...
@@ -29,3 +29,11 @@ ci_project_mirrors:
-
table
:
namespaces
column
:
namespace_id
on_delete
:
async_delete
packages_build_infos
:
-
table
:
ci_pipelines
column
:
pipeline_id
on_delete
:
async_nullify
packages_package_file_build_infos
:
-
table
:
ci_pipelines
column
:
pipeline_id
on_delete
:
async_nullify
spec/db/schema_spec.rb
View file @
77bdbbf9
...
...
@@ -66,8 +66,6 @@ RSpec.describe 'Database schema' do
oauth_access_grants:
%w[resource_owner_id application_id]
,
oauth_access_tokens:
%w[resource_owner_id application_id]
,
oauth_applications:
%w[owner_id]
,
packages_build_infos:
%w[pipeline_id]
,
packages_package_file_build_infos:
%w[pipeline_id]
,
product_analytics_events_experimental:
%w[event_id txn_id user_id]
,
project_group_links:
%w[group_id]
,
project_statistics:
%w[namespace_id]
,
...
...
spec/models/ci/pipeline_spec.rb
View file @
77bdbbf9
...
...
@@ -35,8 +35,6 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
it
{
is_expected
.
to
have_many
(
:sourced_pipelines
)
}
it
{
is_expected
.
to
have_many
(
:triggered_pipelines
)
}
it
{
is_expected
.
to
have_many
(
:pipeline_artifacts
)
}
it
{
is_expected
.
to
have_many
(
:package_build_infos
).
dependent
(
:nullify
).
inverse_of
(
:pipeline
)
}
it
{
is_expected
.
to
have_many
(
:package_file_build_infos
).
dependent
(
:nullify
).
inverse_of
(
:pipeline
)
}
it
{
is_expected
.
to
have_one
(
:chat_data
)
}
it
{
is_expected
.
to
have_one
(
:source_pipeline
)
}
...
...
spec/support/database/cross-database-modification-allowlist.yml
View file @
77bdbbf9
...
...
@@ -20,7 +20,6 @@
-
"
./spec/controllers/admin/users_controller_spec.rb"
-
"
./spec/controllers/omniauth_callbacks_controller_spec.rb"
-
"
./spec/controllers/projects/issues_controller_spec.rb"
-
"
./spec/controllers/projects/pipelines_controller_spec.rb"
-
"
./spec/controllers/projects/settings/access_tokens_controller_spec.rb"
-
"
./spec/features/issues/issue_detail_spec.rb"
-
"
./spec/features/projects/pipelines/pipeline_spec.rb"
...
...
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