Delete duplicate issuable resource links
What does this MR do and why?
We proceed to delete issuable_resouce_links#is_unique = false
(those are duplicates) after having marked issuable_resource_links#is_unique => { true, false }
in !144327 (merged).
References
Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
- Context: #377831
- Implementation plan: #437902
- Pre-requisite: !144327 (merged)
QUERY Plan
gitlabhq_development=# EXPLAIN DELETE FROM "issuable_resource_links" WHERE "issuable_resource_links"."is_unique" = FALSE;
QUERY PLAN
--------------------------------------------------------------------------------
Delete on issuable_resource_links (cost=0.00..16.40 rows=0 width=0)
-> Seq Scan on issuable_resource_links (cost=0.00..16.40 rows=320 width=6)
Filter: (NOT is_unique)
(3 rows)
Raw SQL
[1] pry(main)> IncidentManagement::IssuableResourceLink.where(is_unique: false).delete_all
IncidentManagement::IssuableResourceLink Delete All (1.6ms) DELETE FROM "issuable_resource_links" WHERE "issuable_resource_links"."is_unique" = FALSE
Data
Data before migration
Data after migration
Edited by Tomasz Skorupa