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
84bac952
Commit
84bac952
authored
Jan 13, 2022
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Swap FK ci_freeze_periods to projects for LFK
Removes FK for ci_freeze_periods 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/20220113013319_remove_projects_ci_freeze_periods_project_id_fk.rb
...013319_remove_projects_ci_freeze_periods_project_id_fk.rb
+15
-0
db/schema_migrations/20220113013319
db/schema_migrations/20220113013319
+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/freeze_period_spec.rb
spec/models/ci/freeze_period_spec.rb
+5
-0
No files found.
db/post_migrate/20220113013319_remove_projects_ci_freeze_periods_project_id_fk.rb
0 → 100644
View file @
84bac952
# frozen_string_literal: true
class
RemoveProjectsCiFreezePeriodsProjectIdFk
<
Gitlab
::
Database
::
Migration
[
1.0
]
disable_ddl_transaction!
def
up
with_lock_retries
do
remove_foreign_key_if_exists
(
:ci_freeze_periods
,
:projects
,
name:
"fk_2e02bbd1a6"
)
end
end
def
down
add_concurrent_foreign_key
(
:ci_freeze_periods
,
:projects
,
name:
"fk_2e02bbd1a6"
,
column: :project_id
,
target_column: :id
,
on_delete:
"cascade"
)
end
end
db/schema_migrations/20220113013319
0 → 100644
View file @
84bac952
ccfbbbe52b27833453f867c4d7093187d21dbbfebe054b366ff010c54de50974
\ No newline at end of file
db/structure.sql
View file @
84bac952
...
...
@@ -29171,9 +29171,6 @@ ALTER TABLE ONLY agent_group_authorizations
ALTER TABLE ONLY deployment_approvals
ADD CONSTRAINT fk_2d060dfc73 FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_freeze_periods
ADD CONSTRAINT fk_2e02bbd1a6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY notes
ADD CONSTRAINT fk_2e82291620 FOREIGN KEY (review_id) REFERENCES reviews(id) ON DELETE SET NULL;
lib/gitlab/database/gitlab_loose_foreign_keys.yml
View file @
84bac952
---
dast_site_profiles_pipelines
:
-
table
:
ci_pipelines
column
:
ci_pipeline_id
...
...
@@ -34,6 +35,10 @@ ci_daily_build_group_report_results:
-
table
:
namespaces
column
:
group_id
on_delete
:
async_delete
ci_freeze_periods
:
-
table
:
projects
column
:
project_id
on_delete
:
async_delete
ci_pending_builds
:
-
table
:
namespaces
column
:
namespace_id
...
...
spec/models/ci/freeze_period_spec.rb
View file @
84bac952
...
...
@@ -5,6 +5,11 @@ require 'spec_helper'
RSpec
.
describe
Ci
::
FreezePeriod
,
type: :model
do
subject
{
build
(
:ci_freeze_period
)
}
it_behaves_like
'cleanup by a loose foreign key'
do
let!
(
:parent
)
{
create
(
:project
)
}
let!
(
:model
)
{
create
(
:ci_freeze_period
,
project:
parent
)
}
end
let
(
:invalid_cron
)
{
'0 0 0 * *'
}
it
{
is_expected
.
to
belong_to
(
:project
)
}
...
...
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