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
690ec1eb
Commit
690ec1eb
authored
Apr 03, 2021
by
Lee Tickett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retain timelogs for deleted notes
parent
d9804f75
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
3 deletions
+35
-3
changelogs/unreleased/retain-timelogs-for-deleted-notes.yml
changelogs/unreleased/retain-timelogs-for-deleted-notes.yml
+5
-0
db/post_migrate/20210403022952_remove_notes_delete_cascade_timelogs.rb
...te/20210403022952_remove_notes_delete_cascade_timelogs.rb
+26
-0
db/schema_migrations/20210403022952
db/schema_migrations/20210403022952
+1
-0
db/structure.sql
db/structure.sql
+3
-3
No files found.
changelogs/unreleased/retain-timelogs-for-deleted-notes.yml
0 → 100644
View file @
690ec1eb
---
title
:
Prevent loss of timelogs when deleting notes
merge_request
:
58525
author
:
Lee Tickett @leetickett
type
:
fixed
db/post_migrate/20210403022952_remove_notes_delete_cascade_timelogs.rb
0 → 100644
View file @
690ec1eb
# frozen_string_literal: true
class
RemoveNotesDeleteCascadeTimelogs
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
CONSTRAINT_NAME
=
'fk_timelogs_note_id'
disable_ddl_transaction!
def
up
add_concurrent_foreign_key
:timelogs
,
:notes
,
column: :note_id
,
on_delete: :nullify
,
name:
CONSTRAINT_NAME
with_lock_retries
do
remove_foreign_key_if_exists
:timelogs
,
:notes
,
column: :note_id
,
on_delete: :cascade
end
end
def
down
add_concurrent_foreign_key
:timelogs
,
:notes
,
column: :note_id
,
on_delete: :cascade
with_lock_retries
do
remove_foreign_key_if_exists
:timelogs
,
:notes
,
column: :note_id
,
on_delete: :nullify
,
name:
CONSTRAINT_NAME
end
end
end
db/schema_migrations/20210403022952
0 → 100644
View file @
690ec1eb
c62c2e13bdad42cc1f112f9854fe8d25e1e2aa082cb28341a661c93b8587f1f8
\ No newline at end of file
db/structure.sql
View file @
690ec1eb
...
...
@@ -25028,9 +25028,6 @@ ALTER TABLE ONLY issues
ALTER TABLE ONLY protected_branch_merge_access_levels
ADD CONSTRAINT fk_8a3072ccb3 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;
ALTER TABLE ONLY timelogs
ADD CONSTRAINT fk_8d058cd571 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;
ALTER TABLE ONLY releases
ADD CONSTRAINT fk_8e4456f90f FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;
...
...
@@ -26885,6 +26882,9 @@ ALTER TABLE ONLY timelogs
ALTER TABLE ONLY timelogs
ADD CONSTRAINT fk_timelogs_merge_requests_merge_request_id FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
ALTER TABLE ONLY timelogs
ADD CONSTRAINT fk_timelogs_note_id FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE SET NULL;
ALTER TABLE ONLY u2f_registrations
ADD CONSTRAINT fk_u2f_registrations_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
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