Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

WIP: cascading soft delete #2324

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

kwk
Copy link
Collaborator

@kwk kwk commented Oct 22, 2018

PLEASE: DO NOT MERGE WHEN THERE'S ONLY ONE APPROVAL.

See https://github.com/fabric8-services/fabric8-wit/blob/12f42bbe747f33bf0e3fe485d35ff66ac021d613/docs/cascading-soft-delete.md#cascading-soft-deletes for a description of what this PR does and why.

In addition to adding the cascading soft-delete mechanism for our complete database, I had to make a few adjustments to some tables:

  • Delete no longer needed work_item_link_categories categories that is no longer used since migration 106.

  • Add missing foreign key constraint from comments to work_items item and delete all comments that don't reference a work item.

  • Change foreign key from tracker_items and tracker_queries to trackers from ON UPDATE RESTRICT ON DELETE RESTRICT to ON DELETE CASCADE.

  • Change foreign key from identites to users to ON DELETE CASCADE.

  • Implements [4] When a workitem is deleted, all links associated with it are deleted of Delete workitem #2304

  • Addresses Work items are not deleted when space is removed openshiftio/openshift.io#4382

@kwk kwk self-assigned this Oct 22, 2018
@alien-ike alien-ike changed the title WIP: cascaded-soft-deletes cascaded-soft-deletes Oct 22, 2018
@alien-ike alien-ike changed the title WIP: cascaded-soft-deletes cascaded-soft-deletes Oct 22, 2018
@codecov
Copy link

codecov bot commented Oct 22, 2018

Codecov Report

Merging #2324 into master will decrease coverage by 0.17%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2324      +/-   ##
==========================================
- Coverage   70.17%   69.99%   -0.18%     
==========================================
  Files         171      171              
  Lines       16625    16610      -15     
==========================================
- Hits        11666    11626      -40     
- Misses       3829     3861      +32     
+ Partials     1130     1123       -7
Impacted Files Coverage Δ
remoteworkitem/jira.go 75% <0%> (-25%) ⬇️
remoteworkitem/scheduler.go 53.65% <0%> (-7.32%) ⬇️
gormsupport/postgres.go 39.28% <0%> (-3.14%) ⬇️
controller/workitem.go 78.27% <0%> (-2.91%) ⬇️
search/search_repository.go 76.44% <0%> (-1.14%) ⬇️
spacetemplate/importer/repository.go 73.33% <0%> (ø) ⬆️
migration/migration.go 69.28% <0%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9dc1c08...9905137. Read the comment docs.

@kwk kwk changed the title cascaded-soft-deletes cascading soft delete Oct 23, 2018
@kwk kwk changed the title cascading soft delete WIP: cascading soft delete Oct 23, 2018
@kwk kwk changed the title WIP: cascading soft delete cascading soft delete Oct 25, 2018
@kwk kwk changed the title cascading soft delete WIP: cascading soft delete Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants