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
abea2e32
Commit
abea2e32
authored
Jan 13, 2022
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes FK for ci_pipeline_schedules to users
Changelog: changed
parent
b5fb1331
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
3 deletions
+22
-3
db/post_migrate/20220113040447_remove_users_ci_pipeline_schedules_owner_id_fk.rb
...3040447_remove_users_ci_pipeline_schedules_owner_id_fk.rb
+15
-0
db/schema_migrations/20220113040447
db/schema_migrations/20220113040447
+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
+1
-0
spec/models/ci/pipeline_schedule_spec.rb
spec/models/ci/pipeline_schedule_spec.rb
+5
-0
No files found.
db/post_migrate/20220113040447_remove_users_ci_pipeline_schedules_owner_id_fk.rb
0 → 100644
View file @
abea2e32
# frozen_string_literal: true
class
RemoveUsersCiPipelineSchedulesOwnerIdFk
<
Gitlab
::
Database
::
Migration
[
1.0
]
disable_ddl_transaction!
def
up
with_lock_retries
do
remove_foreign_key_if_exists
(
:ci_pipeline_schedules
,
:users
,
name:
"fk_9ea99f58d2"
)
end
end
def
down
add_concurrent_foreign_key
(
:ci_pipeline_schedules
,
:users
,
name:
"fk_9ea99f58d2"
,
column: :owner_id
,
target_column: :id
,
on_delete: :nullify
)
end
end
db/schema_migrations/20220113040447
0 → 100644
View file @
abea2e32
983e5522b2798ca0d17ca3fd848f527b12afdbdd1482a2d420c4c6ce4fa2c9c4
\ No newline at end of file
db/structure.sql
View file @
abea2e32
...
...
@@ -29522,9 +29522,6 @@ ALTER TABLE ONLY protected_environments
ALTER TABLE ONLY alert_management_alerts
ADD CONSTRAINT fk_9e49e5c2b7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_pipeline_schedules
ADD CONSTRAINT fk_9ea99f58d2 FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE SET NULL;
ALTER TABLE ONLY protected_branch_push_access_levels
ADD CONSTRAINT fk_9ffc86a3d9 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;
lib/gitlab/database/gitlab_loose_foreign_keys.yml
View file @
abea2e32
---
dast_site_profiles_pipelines
:
-
table
:
ci_pipelines
column
:
ci_pipeline_id
...
...
spec/models/ci/pipeline_schedule_spec.rb
View file @
abea2e32
...
...
@@ -23,6 +23,11 @@ RSpec.describe Ci::PipelineSchedule do
subject
{
build
(
:ci_pipeline_schedule
,
project:
project
)
}
end
it_behaves_like
'cleanup by a loose foreign key'
do
let!
(
:parent
)
{
create
(
:user
)
}
let!
(
:model
)
{
create
(
:ci_pipeline_schedule
,
owner:
parent
)
}
end
describe
'validations'
do
it
'does not allow invalid cron patterns'
do
pipeline_schedule
=
build
(
:ci_pipeline_schedule
,
cron:
'0 0 0 * *'
)
...
...
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