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
3e4b5984
Commit
3e4b5984
authored
Jan 13, 2022
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add LFK ci_unit_tests to projects on project_id
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/20220112230642_remove_projects_ci_unit_tests_project_id_fk.rb
...0112230642_remove_projects_ci_unit_tests_project_id_fk.rb
+15
-0
db/schema_migrations/20220112230642
db/schema_migrations/20220112230642
+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/unit_test_spec.rb
spec/models/ci/unit_test_spec.rb
+5
-0
No files found.
db/post_migrate/20220112230642_remove_projects_ci_unit_tests_project_id_fk.rb
0 → 100644
View file @
3e4b5984
# frozen_string_literal: true
class
RemoveProjectsCiUnitTestsProjectIdFk
<
Gitlab
::
Database
::
Migration
[
1.0
]
disable_ddl_transaction!
def
up
with_lock_retries
do
remove_foreign_key_if_exists
(
:ci_unit_tests
,
:projects
,
name:
"fk_7a8fabf0a8"
)
end
end
def
down
add_concurrent_foreign_key
(
:ci_unit_tests
,
:projects
,
name:
"fk_7a8fabf0a8"
,
column: :project_id
,
target_column: :id
,
on_delete:
"cascade"
)
end
end
db/schema_migrations/20220112230642
0 → 100644
View file @
3e4b5984
c528730414c1dcda5d312f03d4e37a0dbb51ebb0b0b87ada786cf686c358daa7
\ No newline at end of file
db/structure.sql
View file @
3e4b5984
...
...
@@ -29384,9 +29384,6 @@ ALTER TABLE ONLY analytics_devops_adoption_snapshots
ALTER TABLE ONLY lists
ADD CONSTRAINT fk_7a5553d60f FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_unit_tests
ADD CONSTRAINT fk_7a8fabf0a8 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY protected_branches
ADD CONSTRAINT fk_7a9c6d93e7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
lib/gitlab/database/gitlab_loose_foreign_keys.yml
View file @
3e4b5984
---
dast_site_profiles_pipelines
:
-
table
:
ci_pipelines
column
:
ci_pipeline_id
...
...
@@ -67,6 +68,10 @@ ci_project_mirrors:
-
table
:
namespaces
column
:
namespace_id
on_delete
:
async_delete
ci_unit_tests
:
-
table
:
projects
column
:
project_id
on_delete
:
async_delete
merge_requests
:
-
table
:
ci_pipelines
column
:
head_pipeline_id
...
...
spec/models/ci/unit_test_spec.rb
View file @
3e4b5984
...
...
@@ -3,6 +3,11 @@
require
'spec_helper'
RSpec
.
describe
Ci
::
UnitTest
do
it_behaves_like
'cleanup by a loose foreign key'
do
let!
(
:parent
)
{
create
(
:project
)
}
let!
(
:model
)
{
create
(
:ci_unit_test
,
project:
parent
)
}
end
describe
'relationships'
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
it
{
is_expected
.
to
have_many
(
:unit_test_failures
)
}
...
...
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